scclib
Stable Cloud Computing C++ Library
|
RSA OAEP encryption. More...
#include <rsa.h>
Public Member Functions | |
RsaOaepEncrypt (RsaPublicKey &, Hash::Algorithm=Hash::sha1_type) | |
Construct an RSA encryptor. More... | |
int | max_msg_size () const |
The maximum allowable plain text size in bytes. More... | |
int | cipher_size () const |
Cipher text size in bytes. More... | |
void | encrypt (const void *, int, void *, int, const void *=nullptr, int=0) |
Encrypt a message. More... | |
RSA OAEP encryption.
Encrypts using OAEP scheme. Requires a public key, and choice of hash algorithm.
scc::crypto::RsaOaepEncrypt::RsaOaepEncrypt | ( | RsaPublicKey & | , |
Hash::Algorithm | = Hash::sha1_type |
||
) |
Construct an RSA encryptor.
key | Valid public key. |
hash_type | Hash algorithm from scc::crypto::Hash. |
int scc::crypto::RsaOaepEncrypt::cipher_size | ( | ) | const |
Cipher text size in bytes.
len(public key width)
void scc::crypto::RsaOaepEncrypt::encrypt | ( | const void * | , |
int | , | ||
void * | , | ||
int | , | ||
const void * | = nullptr , |
||
int | = 0 |
||
) |
Encrypt a message.
msg_loc | Plaintext message buffer |
msg_len | Plaintext size, must be <= max_msg_len() |
cipher_loc | Encrypted ciphertext buffer |
cipher_len | Ciphertext size, must be exactly cipher_len() |
label_loc | Optional label, which will be verified but not encrypted |
label_len | Label length |
Throws exception on parameter error.
int scc::crypto::RsaOaepEncrypt::max_msg_size | ( | ) | const |
The maximum allowable plain text size in bytes.
len(public key width) - 2*size(hash output) - 2