RSA class. More...
#include <rsa.h>
Static Public Member Functions | |
Attributes | |
| static void | create_keypair (CL_Random &random, CL_Secret &out_private_exponent, CL_DataBuffer &out_public_exponent, CL_DataBuffer &out_modulus, int key_size_in_bits=1024, int public_exponent_value=65537) |
| Create a keypair. | |
| static CL_DataBuffer | encrypt (int block_type, CL_Random &random, const CL_DataBuffer &in_public_exponent, const CL_DataBuffer &in_modulus, const CL_Secret &in_data) |
| Encrypt. | |
| static CL_DataBuffer | encrypt (int block_type, CL_Random &random, const void *in_public_exponent, unsigned int in_public_exponent_size, const void *in_modulus, unsigned int in_modulus_size, const void *in_data, unsigned int in_data_size) |
| Encrypt. | |
| static CL_Secret | decrypt (const CL_Secret &in_private_exponent, const CL_DataBuffer &in_modulus, const CL_DataBuffer &in_data) |
| Decrypt. | |
| static CL_Secret | decrypt (const CL_Secret &in_private_exponent, const void *in_modulus, unsigned int in_modulus_size, const void *in_data, unsigned int in_data_size) |
| Decrypt. | |
RSA class.
Important: This class has NOT been tested thoroughly by a cryptography expert.
| static void CL_RSA::create_keypair | ( | CL_Random & | random, | |
| CL_Secret & | out_private_exponent, | |||
| CL_DataBuffer & | out_public_exponent, | |||
| CL_DataBuffer & | out_modulus, | |||
| int | key_size_in_bits = 1024, |
|||
| int | public_exponent_value = 65537 | |||
| ) | [static] |
Create a keypair.
| random | = Random number generator | |
| out_private_exponent | = Private exponent (to decrypt with) | |
| out_public_exponent | = Public exponent (to encrypt with) | |
| out_modulus | = Modulus | |
| key_size_in_bits | = key size in bits | |
| public_exponent_value | = public exponent value |
| static CL_Secret CL_RSA::decrypt | ( | const CL_Secret & | in_private_exponent, | |
| const void * | in_modulus, | |||
| unsigned int | in_modulus_size, | |||
| const void * | in_data, | |||
| unsigned int | in_data_size | |||
| ) | [static] |
Decrypt.
Warning: An exception may be thrown when decrypting if in_data is not valid. Be careful handling this, to prevent "timing attacks"
| in_private_exponent | = Private exponent | |
| in_modulus | = Modulus | |
| in_modulus_size | = size in bytes of in_modulus | |
| in_data | = Data to encrypt | |
| in_data_size | = size in bytes of in_data (length equals in_modulus_size) |
| static CL_Secret CL_RSA::decrypt | ( | const CL_Secret & | in_private_exponent, | |
| const CL_DataBuffer & | in_modulus, | |||
| const CL_DataBuffer & | in_data | |||
| ) | [static] |
Decrypt.
Warning: An exception may be thrown when decrypting if in_data is not valid. Be careful handling this, to prevent "timing attacks"
| in_private_exponent | = Private exponent | |
| in_modulus | = Modulus | |
| in_data | = Data to decrypt (length equals in_modulus.get_size()) |
| static CL_DataBuffer CL_RSA::encrypt | ( | int | block_type, | |
| CL_Random & | random, | |||
| const void * | in_public_exponent, | |||
| unsigned int | in_public_exponent_size, | |||
| const void * | in_modulus, | |||
| unsigned int | in_modulus_size, | |||
| const void * | in_data, | |||
| unsigned int | in_data_size | |||
| ) | [static] |
Encrypt.
| block_type | = 0 (private key), 1 (private key) or 2 (public key) | |
| random | = Random number generator | |
| in_public_exponent | = Public exponent | |
| in_public_exponent_size | = size in bytes of in_public_exponent | |
| in_modulus | = Modulus | |
| in_modulus_size | = size in bytes of in_modulus | |
| in_data | = Data to encrypt | |
| in_data_size | = size in bytes of in_data (maximum size is in_modulus_size - 11) |
| static CL_DataBuffer CL_RSA::encrypt | ( | int | block_type, | |
| CL_Random & | random, | |||
| const CL_DataBuffer & | in_public_exponent, | |||
| const CL_DataBuffer & | in_modulus, | |||
| const CL_Secret & | in_data | |||
| ) | [static] |
Encrypt.
| block_type | = 0 (private key), 1 (private key) or 2 (public key) | |
| random | = Random number generator | |
| in_public_exponent | = Public exponent | |
| in_modulus | = Modulus | |
| in_data | = Data to encrypt (maximum length is in_modulus.get_size() - 11) |
1.7.1