1 #ifndef RSA_CRYPTO_CLASS
2 #define RSA_CRYPTO_CLASS
23 typedef struct rsa_st
RSA;
A very common template for a dynamic array of bytes.
Root object for any class that knows its own name.
Supports public key encryption and decryption.
const rsa_crypto & operator=(const rsa_crypto &to_copy)
bool public_encrypt(const basis::byte_array &source, basis::byte_array &target) const
encrypts "source" using our public key and stores it in "target".
bool set_key(basis::byte_array &key)
resets this object's key to "key".
bool private_key(basis::byte_array &privkey) const
makes a copy of the private key held here.
static RSA * generate_key(int key_size)
creates a random RSA key using the lower-level openssl methods.
bool private_decrypt(const basis::byte_array &source, basis::byte_array &target) const
decrypts "source" using our private key and stores it in "target".
bool public_decrypt(const basis::byte_array &source, basis::byte_array &target) const
decrypts "source" using our public key and stores it in "target".
DEFINE_CLASS_NAME("rsa_crypto")
bool check_key(RSA *key)
checks the RSA "key" provided for validity.
bool private_encrypt(const basis::byte_array &source, basis::byte_array &target) const
encrypts "source" using our private key and stores it in "target".
bool public_key(basis::byte_array &pubkey) const
makes a copy of the public key held here.
rsa_crypto(int key_size)
constructs using a randomized private key of the "key_size".