SuperpoweredSDK  v2.0.2
Superpowered Audio SDK
Superpowered::RSAPublicKey Class Reference

Forward declaration. More...

#include "SuperpoweredRSA.h"

Public Member Functions

 ~RSAPublicKey ()
 Destructor. More...
 
unsigned char * encrypt (unsigned int inputLengthBytes, void *input, bool OAEP_PSS_V21)
 RSA encryption with public key. More...
 
unsigned int getEncryptedOutputSizeBytes ()
 
bool verifySignature (hashType alg, unsigned int inputLengthBytes, void *input, const unsigned char *signature, bool OAEP_PSS_V21)
 RSA signature verification. More...
 
bool verifySignatureHash (hashType alg, unsigned int hashLengthBytes, const unsigned char *hash, const unsigned char *signature, bool OAEP_PSS_V21)
 RSA signature verification. More...
 

Static Public Member Functions

static RSAPublicKeycreateFromDER (const unsigned char *der, unsigned int derLengthBytes)
 Creates an RSA public key object from DER data. More...
 
static RSAPublicKeycreateFromPEM (const char *pem, unsigned int pemLengthBytes)
 Creates an RSA public key object from a PEM string. More...
 

Private Member Functions

 RSAPublicKey (void *)
 

Private Attributes

RSAContext * internals
 

Friends

class RSAPrivateKey
 

Detailed Description

Forward declaration.

RSA public key object.

Constructor & Destructor Documentation

◆ ~RSAPublicKey()

Superpowered::RSAPublicKey::~RSAPublicKey ( )

Destructor.

◆ RSAPublicKey()

Superpowered::RSAPublicKey::RSAPublicKey ( void *  )
private

Member Function Documentation

◆ createFromDER()

static RSAPublicKey* Superpowered::RSAPublicKey::createFromDER ( const unsigned char *  der,
unsigned int  derLengthBytes 
)
static

Creates an RSA public key object from DER data.

Parameters
derDER data.
derLengthBytesDER data length in bytes.
Returns
The new RSA public key object or NULL on memory allocation error or invalid DER data.

◆ createFromPEM()

static RSAPublicKey* Superpowered::RSAPublicKey::createFromPEM ( const char *  pem,
unsigned int  pemLengthBytes 
)
static

Creates an RSA public key object from a PEM string.

Parameters
pemPEM string.
pemLengthBytesPEM string length (not including the trailing zero if any).
Returns
The new RSA public key object or NULL on memory allocation error or invalid PEM data.

◆ encrypt()

unsigned char* Superpowered::RSAPublicKey::encrypt ( unsigned int  inputLengthBytes,
void *  input,
bool  OAEP_PSS_V21 
)

RSA encryption with public key.

Parameters
inputLengthBytesThe length of input in bytes.
inputInput data.
OAEP_PSS_V21True for OAEP PSS v2.1, false for PKCS1 v1.5.
Returns
Encrypted data or NULL on error. Don't forget to free() this at a later point to prevent memory leaks!

◆ getEncryptedOutputSizeBytes()

unsigned int Superpowered::RSAPublicKey::getEncryptedOutputSizeBytes ( )
Returns
Returns with the encrypted output data size in bytes.

◆ verifySignature()

bool Superpowered::RSAPublicKey::verifySignature ( hashType  alg,
unsigned int  inputLengthBytes,
void *  input,
const unsigned char *  signature,
bool  OAEP_PSS_V21 
)

RSA signature verification.

Parameters
algThe hashing algorithm to use.
inputLengthBytesThe length of input in bytes.
inputInput data.
signatureSignature string.
OAEP_PSS_V21True for OAEP PSS v2.1, false for PKCS1 v1.5.
Returns
True if the signature is valid, false otherwise.

◆ verifySignatureHash()

bool Superpowered::RSAPublicKey::verifySignatureHash ( hashType  alg,
unsigned int  hashLengthBytes,
const unsigned char *  hash,
const unsigned char *  signature,
bool  OAEP_PSS_V21 
)

RSA signature verification.

Parameters
algThe hashing algorithm to use.
hashLengthBytesThe length of hash in bytes.
hashHash data.
signatureSignature string.
OAEP_PSS_V21True for OAEP PSS v2.1, false for PKCS1 v1.5.
Returns
True if the signature is valid, false otherwise.

Friends And Related Function Documentation

◆ RSAPrivateKey

friend class RSAPrivateKey
friend

Member Data Documentation

◆ internals

RSAContext* Superpowered::RSAPublicKey::internals
private

The documentation for this class was generated from the following file: