#include <rsa.h>
Static Public Member Functions | |
| static void | create_keypair (Random &random, Secret &out_private_exponent, DataBuffer &out_public_exponent, DataBuffer &out_modulus, int key_size_in_bits=1024, int public_exponent_value=65537) |
| Create a keypair. | |
| static Secret | decrypt (const Secret &in_private_exponent, const DataBuffer &in_modulus, const DataBuffer &in_data) |
| Decrypt. | |
| static Secret | decrypt (const Secret &in_private_exponent, const void *in_modulus, unsigned int in_modulus_size, const void *in_data, unsigned int in_data_size) |
| Decrypt. | |
| static DataBuffer | encrypt (int block_type, Random &random, const DataBuffer &in_public_exponent, const DataBuffer &in_modulus, const Secret &in_data) |
| Encrypt. | |
| static DataBuffer | encrypt (int block_type, 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. | |
RSA class.
Important: This class has NOT been tested thoroughly by a cryptography expert.
|
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 |
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 |
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 |
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) |
|
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) |