PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFBPubKey
Wrapper Class for the IPubKey interface.
#include <SFBPubKey.h.hpp>
class SFBPubKey : public SFBParameters;
SFMTYPEDEFWRAPPER(SFBPubKey)

Inheritance diagram

 Inheritance diagram of SFBPubKeyClass

Version

BREW 2.0 BREW 2.1 BREW 3.1 BREW 4.0
X X X O

Reference

BREW API IPubKey

Member

Public Functions
Void Decrypt( UInt08ConstPtr inBuf , SInt32 inBufLen , UInt08Ptr outBuf , SInt32Ptr outBufLen , SInt32 padType , SInt32Ptr result , SFXCallbackPtr callback )
Call this method to perform decryption using a private key.
Void Encrypt( UInt08ConstPtr inBuf , SInt32 inBufLen , UInt08Ptr outBuf , SInt32Ptr outBufLen , SInt32 padType , SInt32Ptr result , SFXCallbackPtr callback )
Call this method to perform encryption using a public key.
static
SFBPubKeySmp
NewInstance( SFCErrorPtr exception = null )
Create a new SFBPubKey instance.
static
SFBPubKeySmp
NewInstance( AEECLSID id , SFCErrorPtr exception = null )
Create a new SFBPubKey instance.
Void Sign( UInt08ConstPtr hash , SInt32 hashLen , UInt08Ptr sign , SInt32Ptr signLen , SInt32 padType , SInt32Ptr result , SFXCallbackPtr callback )
Call this method to digitally sign some data.
Void Verify( UInt08ConstPtr sign , SInt32 signLen , UInt08Ptr hash , SInt32 hashLen , SInt32 padType , SInt32Ptr result , SFXCallbackPtr callback )
Call this method to verify a signature.
SFCError SetParam( SInt32 id , VoidConstPtr data , UInt32 length ) (inherits from SFBParameters)
This method sets a parameter value.
SFCError SetParam( SInt32 id , SFXBufferConstRef data ) (inherits from SFBParameters)
This method sets a parameter value.
SFCError SetParam( SInt32 id , SFXAnsiStringConstRef data ) (inherits from SFBParameters)
This method sets a parameter value.

SFBPubKey::Decrypt
Call this method to perform decryption using a private key.
[ public ]
Void Decrypt(
    UInt08ConstPtr inBuf      // pointer to buffer of data to decrypt 
    SInt32 inBufLen           // length of input buffer 
    UInt08Ptr outBuf          // Pointer to buffer to store encrpypted data, caller allocated 
    SInt32Ptr outBufLen       // Length of output buffer on input, length of data on output 
    SInt32 padType            // Type of padding to use 
    SInt32Ptr result          // Result code 
    SFXCallbackPtr callback   // Pointer to callback record (called when async operation completes)
);

Return value

These return values are in result.

  • AEE_SUCCESS: Successful
  • AEESEC_CRYPT_BUFFER_TOO_SMALL: Output buffer to small
  • AEESEC_CRYPT_INVALID_KEY: Private key not set, SetParam not called
  • AEESEC_CRYPT_INVALID_PADTYPE: Padding type given was wrong
  • AEESEC_CRYPT_PAD_ERROR: After decryption, padding decoding failed (probably means decryption was with wrong key or otherwise failed)
  • AEESEC_CRYPT_INVALID_SIZE: nInBufLen is not equal to the modulus size or pucInBuf is bigger than the modulus
  • AEE_EUNSUPPORTED: Decryption is not supported by this implementation
  • AEE_ENOMEMORY: Ran out of memory while processing
  • IPUBKEY_RAND_SOURCE_ERROR: Random data source was not set properly.

Other error codes as returned by engine

Description

The key used to decrypt must have been set before the operation is attempted.

It is usually set by calling SFBPubKey::SetParam(), but it may be pre set in some implementations such as hardware key stores.

It is also usually the private key of the key pair.

Reference

BREW API IPubKey_Decrypt


SFBPubKey::Encrypt
Call this method to perform encryption using a public key.
[ public ]
Void Encrypt(
    UInt08ConstPtr inBuf      // Pointer to buffer of data to encrypt 
    SInt32 inBufLen           // Length of input buffer 
    UInt08Ptr outBuf          // Pointer to buffer to store encrypted data, caller allocated
    SInt32Ptr outBufLen       // Length of output buffer on input, length of data on output 
    SInt32 padType            // Type of padding to use 
    SInt32Ptr result          // Result code 
    SFXCallbackPtr callback   // Pointer to callback record (called when async operation completes) 
);

Return value

These return values are in result.

  • AEE_SUCCESS: Successful
  • AEESEC_CRYPT_BUFFER_TOO_SMALL: Output buffer to small
  • AEESEC_CRYPT_INVALID_PADTYPE: padding type given was wrong
  • AEESEC_CRYPT_INVALID_KEY: public key not set
  • AEESEC_CRYPT_INVALID_SIZE: nInBufLen is not equal to the modulus size or pucInBuf is bigger than the modulus (in case of nPadType being IPUBKEY_NO_PADDING)
  • AEE_EUNSUPPORTED: Encryption is not supported by this implementation
  • AEE_ENOMEMORY: Ran out of memory while processing
  • IPUBKEY_RAND_SOURCE_ERROR: Random data source was not set properly.

Other error codes as returned by engine

Description

The key used in the encryption must have been set before calling this method. It is usually set by calling SEBPubKey::SetParam().

Reference

BREW API IPubKey_Encrypt


SFBPubKey::NewInstance
Create a new SFBPubKey instance.
[ public, static ]
SFBPubKeySmp NewInstance(
    SFCErrorPtr exception = null   // Error
);
[ public, static ]
SFBPubKeySmp NewInstance(
    AEECLSID id                    // Class ID
    SFCErrorPtr exception = null   // Error
);

SFBPubKey::Sign
Call this method to digitally sign some data.
[ public ]
Void Sign(
    UInt08ConstPtr hash       // pointer to a buffer containing a hash to sign 
    SInt32 hashLen            // the length of the hash 
    UInt08Ptr sign            // pointer to a buffer containing the signature 
    SInt32Ptr signLen         // the length of the signature 
    SInt32 padType            // One of IPUBKEY_SIG_ 
    SInt32Ptr result          // Result code 
    SFXCallbackPtr callback   // pointer to callback record (called when async operation completes), can be NULL (sync mode) 
);

Return value

These return values are in result.

  • AEE_SUCCESS: Successful
  • AEESEC_CRYPT_INVALID_KEY: private key not set, Init not called
  • AEESEC_CRYPT_BUFFER_TOO_SMALL: output buffer to small
  • AEESEC_CRYPT_INVALID_PADTYPE: padding type given was wrong
  • AEESEC_CRYPT_INVALID_SIZE: cbIn is not equal to the modulus size
  • AEE_EUNSUPPORTED: Sign is not supported by implementation
  • AEE_ENOMEMORY: ran out of memory while processing
  • IPUBKEY_RAND_SOURCE_ERROR: Random data source was not set properly.

Other error codes as returned by engine

Description

The key used to sign must have been set before the operation is attempted.

Reference

BREW API IPubKey_Sign


SFBPubKey::Verify
Call this method to verify a signature.
[ public ]
Void Verify(
    UInt08ConstPtr sign       // pointer to a buffer containing a signature 
    SInt32 signLen            // the length of the signature 
    UInt08Ptr hash            // pointer to a buffer containing the expected digest 
    SInt32 hashLen            // the length of the digest 
    SInt32 padType            // One of IPUBKEY_SIG_ 
    SInt32Ptr result          // Result code 
    SFXCallbackPtr callback   // pointer to callback record (called when async operation completes), can be NULL (sync mode) 
);

Return value

These return values are in result.

  • AEE_SUCCESS: Successful
  • AEESEC_CRYPT_INVALID_KEY: public key not set
  • AEESEC_CRYPT_INVALID_PADTYPE: padding type given was wrong
  • AEESIG_INVALID: signature verify failed
  • AEESEC_CRYPT_PAD_ERROR: after decryption, padding decoding failed (probably means decryption was with wrong key or otherwise failed)
  • AEESEC_CRYPT_INVALID_SIZE: nSigLen is not equal to the modulus size
  • AEE_EUNSUPPORTED: Verify is not supported by this implementation
  • AEE_ENOMEMORY: ran out of memory while processing
  • IPUBKEY_RAND_SOURCE_ERROR: Random data source was not set properly.

Other error codes as returned by engine

Description

The key used to verify must have been set before the operation is attempted.

Reference

BREW API IPubKey_Verify