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

RSA private key object. More...

#include "SuperpoweredRSA.h"

Public Member Functions

 ~RSAPrivateKey ()
 Destructor. More...
 
unsigned char * decrypt (void *encrypted, unsigned int *decryptedSizeBytes, bool OAEP_PSS_V21)
 RSA decryption with private key. More...
 
bool isPair (RSAPublicKey *publicKey)
 Checks if a public key is the pair of this private key. More...
 
unsigned char * sign (hashType alg, unsigned int inputLengthBytes, void *input, bool OAEP_PSS_V21)
 Creates an RSA signature. More...
 
unsigned char * signHash (hashType alg, unsigned int hashLengthBytes, const unsigned char *hash, bool OAEP_PSS_V21)
 Creates an RSA signature. More...
 

Static Public Member Functions

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

Private Member Functions

 RSAPrivateKey (void *)
 

Private Attributes

RSAContext * internals
 

Detailed Description

RSA private key object.

Constructor & Destructor Documentation

◆ ~RSAPrivateKey()

Superpowered::RSAPrivateKey::~RSAPrivateKey ( )

Destructor.

◆ RSAPrivateKey()

Superpowered::RSAPrivateKey::RSAPrivateKey ( void *  )
private

Member Function Documentation

◆ createFromDER()

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

Creates an RSA private key object from DER data.

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

◆ createFromPEM()

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

Creates an RSA private key object from a PEM string.

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

◆ decrypt()

unsigned char* Superpowered::RSAPrivateKey::decrypt ( void *  encrypted,
unsigned int *  decryptedSizeBytes,
bool  OAEP_PSS_V21 
)

RSA decryption with private key.

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

◆ isPair()

bool Superpowered::RSAPrivateKey::isPair ( RSAPublicKey publicKey)

Checks if a public key is the pair of this private key.

Parameters
publicKeyThe public key object.
Returns
True if the public key is the pair of this private key, false otherwise.

◆ sign()

unsigned char* Superpowered::RSAPrivateKey::sign ( hashType  alg,
unsigned int  inputLengthBytes,
void *  input,
bool  OAEP_PSS_V21 
)

Creates an RSA signature.

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

◆ signHash()

unsigned char* Superpowered::RSAPrivateKey::signHash ( hashType  alg,
unsigned int  hashLengthBytes,
const unsigned char *  hash,
bool  OAEP_PSS_V21 
)

Creates an RSA signature.

Parameters
algThe hashing algorithm to use.
hashLengthBytesThe length of hash in bytes.
hashHash data.
OAEP_PSS_V21True for OAEP PSS v2.1, false for PKCS1 v1.5.
Returns
Signature string or NULL on error. Don't forget to free() this at a later point to prevent memory leaks!

Member Data Documentation

◆ internals

RSAContext* Superpowered::RSAPrivateKey::internals
private

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