scclib
Stable Cloud Computing C++ Library
|
RSA Private Key. More...
#include <rsa.h>
Public Member Functions | |
RsaPrivateKey (RsaPrivateKey &&other) | |
RsaPrivateKey & | operator= (RsaPrivateKey &&other) |
RsaPrivateKey (const RsaPrivateKey &other) | |
RsaPrivateKey & | operator= (const RsaPrivateKey &other) |
bool | operator== (const RsaPrivateKey &o) const |
bool | operator!= (const RsaPrivateKey &o) const |
void | clear () |
Clear and erase all data. | |
std::string | dump () const |
Dump a string with full values. More... | |
std::string | str (unsigned=8) const |
Output with formatted values. More... | |
void | generate (int) |
Generate a private key. More... | |
bool | validate (const RsaPublicKey &) const |
Validate a public key with the private key. | |
bool | validate () const |
Validate with my public key. | |
void | get (scc::crypto::Bignum &n, scc::crypto::Bignum &e, scc::crypto::Bignum &d, scc::crypto::Bignum &p, scc::crypto::Bignum &q, scc::crypto::Bignum &ep, scc::crypto::Bignum &eq, scc::crypto::Bignum &qinv) const |
void | set (const scc::crypto::Bignum &n, const scc::crypto::Bignum &e, scc::crypto::Bignum &d, scc::crypto::Bignum &p, scc::crypto::Bignum &q, scc::crypto::Bignum &ep, scc::crypto::Bignum &eq, scc::crypto::Bignum &qinv) |
RsaPublicKey | pub_key () const |
Export the public key. | |
![]() | |
RsaPublicKey (RsaPublicKey &&other) | |
RsaPublicKey & | operator= (RsaPublicKey &&other) |
RsaPublicKey (const RsaPublicKey &other) | |
RsaPublicKey & | operator= (const RsaPublicKey &other) |
bool | operator== (const RsaPublicKey &o) const |
bool | operator!= (const RsaPublicKey &o) const |
void | get (scc::crypto::Bignum &n, scc::crypto::Bignum &e) const |
void | set (const scc::crypto::Bignum &n, const scc::crypto::Bignum &e) |
void | clear () |
Clear and erase all data. | |
std::string | dump () const |
Output with full values. | |
std::string | str (unsigned=8) const |
Output with formatted values. More... | |
int | width () const |
Bit width of the key. More... | |
int | width_bytes () const |
Width in bytes of this key. | |
Friends | |
class | PssSignature |
class | PkcsSignature |
class | RsaOaepDecrypt |
Additional Inherited Members | |
![]() | |
scc::crypto::Bignum | m_n |
scc::crypto::Bignum | m_e |
RSA Private Key.
A private key consists of public key and the following: private exponent d prime1 p prime2 q exponent1 ep = d % (p-1) exponent2 eq = d % (q-1) inverse coefficient c = (~q) % p
For security considerations, see: https://www.websecurity.digicert.com/content/dam/websitesecurity/digitalassets/desktop/pdfs/whitepaper/Elliptic_Curve_Cryptography_ECC_WP_en_us.pdf
The key size of a private key is the width(), which is the bit size of the modulus.
Security level means the equivalent security strength to a symmetric key with the stated bit size. Use of algorithms with security below 128 bits is not recommended.
Examples:
std::string scc::crypto::RsaPrivateKey::dump | ( | ) | const |
Dump a string with full values.
Not recommended to log this output.
void scc::crypto::RsaPrivateKey::generate | ( | int | ) |
Generate a private key.
Creates a private key with specified width.
width | Width in bits. Must be even and positive. Note that widths below 1024 are not considered secure. |
Throws exception on error.
std::string scc::crypto::RsaPrivateKey::str | ( | unsigned | = 8 | ) | const |
Output with formatted values.
Emits a maximum number of bytes for each value.