#include <rsa.h>
Static Public Member Functions | |
static void | create_keypair (Random &random, SecretPtr &out_private_exponent, DataBufferPtr &out_public_exponent, DataBufferPtr &out_modulus, int key_size_in_bits=1024, int public_exponent_value=65537) |
Create a keypair. More... | |
static SecretPtr | decrypt (const SecretPtr &in_private_exponent, const DataBufferPtr &in_modulus, const DataBufferPtr &in_data) |
Decrypt. More... | |
static SecretPtr | decrypt (const SecretPtr &in_private_exponent, const void *in_modulus, unsigned int in_modulus_size, const void *in_data, unsigned int in_data_size) |
Decrypt. More... | |
static DataBufferPtr | encrypt (int block_type, Random &random, const DataBufferPtr &in_public_exponent, const DataBufferPtr &in_modulus, const SecretPtr &in_data) |
Encrypt. More... | |
static DataBufferPtr | 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. More... | |
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.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.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) |