libcryptosec
Public Types | Static Public Member Functions | List of all members

static class to perform asymmetric ciphers, using asymmetric keys (eg. RSA keys) More...

#include <AsymmetricCipher.h>

Public Types

enum  Padding { NO_PADDING, PKCS1, SSLV23, PKCS1_OAEP }
 

Static Public Member Functions

static ByteArray encrypt (RSAPublicKey &key, ByteArray &data, AsymmetricCipher::Padding padding) throw (AsymmetricCipherException)
 
static ByteArray encrypt (RSAPublicKey &key, std::string &data, AsymmetricCipher::Padding padding) throw (AsymmetricCipherException)
 
static ByteArray decrypt (RSAPrivateKey &key, ByteArray &data, AsymmetricCipher::Padding padding) throw (AsymmetricCipherException)
 

Detailed Description

static class to perform asymmetric ciphers, using asymmetric keys (eg. RSA keys)

Member Enumeration Documentation

◆ Padding

supported padding values to perform asymmetric ciphers. Default: PKCS1.

Enumerator
NO_PADDING 
PKCS1 
SSLV23 
PKCS1_OAEP 

Member Function Documentation

◆ decrypt()

ByteArray AsymmetricCipher::decrypt ( RSAPrivateKey key,
ByteArray data,
AsymmetricCipher::Padding  padding 
)
throw (AsymmetricCipherException
)
static

decrypt encrypted data using a asymmetric private key

Parameters
keyprivate key to decrypt encrypted data
datadata to be decrypted type of padding to use in process (must be the same used to perform the encrypting operation
Returns
encrypted data
Exceptions
AsymmetricCipherExceptionif any problem happen, throw this exception with a ENCRYPTING_DATA code.

◆ encrypt() [1/2]

ByteArray AsymmetricCipher::encrypt ( RSAPublicKey key,
ByteArray data,
AsymmetricCipher::Padding  padding 
)
throw (AsymmetricCipherException
)
static

encrypt unreadable data using a asymmetric public key

Parameters
keypublic key to encrypt data
datadata to be encrypted type of padding to use in process
Returns
encrypted data
Exceptions
AsymmetricCipherExceptionif any problem happen, throw this exception with a ENCRYPTING_DATA code.

◆ encrypt() [2/2]

ByteArray AsymmetricCipher::encrypt ( RSAPublicKey key,
std::string &  data,
AsymmetricCipher::Padding  padding 
)
throw (AsymmetricCipherException
)
static

encrypt readable data using a asymmetric public key

Parameters
keypublic key to encrypt data
datadata to be encrypted type of padding to use in process
Returns
encrypted data
Exceptions
AsymmetricCipherExceptionif any problem happen, throw this exception with a ENCRYPTING_DATA code.

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