scclib
Stable Cloud Computing C++ Library
Public Member Functions | Friends | List of all members
scc::crypto::RsaPrivateKey Class Reference

RSA Private Key. More...

#include <rsa.h>

Inheritance diagram for scc::crypto::RsaPrivateKey:
Inheritance graph
[legend]
Collaboration diagram for scc::crypto::RsaPrivateKey:
Collaboration graph
[legend]

Public Member Functions

 RsaPrivateKey (RsaPrivateKey &&other)
 
RsaPrivateKeyoperator= (RsaPrivateKey &&other)
 
 RsaPrivateKey (const RsaPrivateKey &other)
 
RsaPrivateKeyoperator= (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.
 
- Public Member Functions inherited from scc::crypto::RsaPublicKey
 RsaPublicKey (RsaPublicKey &&other)
 
RsaPublicKeyoperator= (RsaPublicKey &&other)
 
 RsaPublicKey (const RsaPublicKey &other)
 
RsaPublicKeyoperator= (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

- Protected Attributes inherited from scc::crypto::RsaPublicKey
scc::crypto::Bignum m_n
 
scc::crypto::Bignum m_e
 

Detailed Description

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:

Definition at line 184 of file rsa.h.

Member Function Documentation

◆ dump()

std::string scc::crypto::RsaPrivateKey::dump ( ) const

Dump a string with full values.

Not recommended to log this output.

◆ generate()

void scc::crypto::RsaPrivateKey::generate ( int  )

Generate a private key.

Creates a private key with specified width.

Parameters
widthWidth in bits. Must be even and positive. Note that widths below 1024 are not considered secure.

Throws exception on error.

◆ str()

std::string scc::crypto::RsaPrivateKey::str ( unsigned  = 8) const

Output with formatted values.

Emits a maximum number of bytes for each value.


The documentation for this class was generated from the following file: