#include <pk.h>
Inheritance diagram for RSA:


Code samples illustrating the use of class RSA can be found in the Cookbook section Handling Public and Private Keys.
Public Types | |
| pkcs1 = 1 | |
| Perform PKCS#1 v1.5 compliant operations. | |
| x931 = 2 | |
| Perform ANSI x9.31 compliant operations. | |
| pss = 3 | |
| Use PSS (PKCS#1 v2.1). | |
| enum | { pkcs1 = 1, x931 = 2, pss = 3 } |
| Standards compliance flags. More... | |
Public Member Functions | |
| RSA () | |
| Constructor used to create an empty RSA object (PKCS#1 with 2 primes). | |
| virtual | ~RSA () |
| Destructor. | |
| int | check () const |
| Check the consistency of the public and private key components in this object. | |
| int | loadpub (const num &expo1, const num &pq1) |
| Load a (raw) RSA public key into this object. | |
| int | loadpriv (const num &p1) |
| Load (raw) RSA private key into this object (as a single prime factor of the modulus). | |
| int | loadpriv (const num &p1, const num &q1) |
| Load a (raw) RSA private key into this object (as a pair of prime factors of the modulus). | |
| str | asn1private () const |
| Get this object's ASN.1 DER-encoded private key. | |
| int | loadasn1private (const str &b1) |
| Load an ASN.1 DER-encoded private key. | |
| int | loadpub (const str &pubk) |
| Load an ASN.1 DER-encoded public key. | |
| int | genpub () |
| Generate a public key based on the private key in this object. | |
| int | setup () |
| Derive PKCS#1 RSA private key components from the prime factors of the modulus. | |
| int | encrypt (const num &m, num &x) const |
| Encrypt a specified buffer. | |
| int | decrypt (const num &c, num &x) const |
| Decrypt a specified buffer. | |
| int | sign (const num &hash, const num &random, num &sig, int nHashType) const |
| Sign a specified message digest. | |
| bool | hasPrivate () const |
| Predicate used to test whether this object contains a private key. | |
| bool | hasPublic () const |
| Predicate used to test whether this object contains a public key. | |
| void | clear () |
| Clear this object. | |
| anonymous enum |
| str asn1private | ( | ) | const |
Get this object's ASN.1 DER-encoded private key.
| int check | ( | ) | const |
Check the consistency of the public and private key components in this object.
| void clear | ( | void | ) | [inline] |
Clear this object.
Decrypt a specified buffer.
| c | a num representing the ciphertext to decrypt | |
| x | a num to receive the plaintext output |
Encrypt a specified buffer.
| m | a num representing the message to encrypt | |
| x | a num to receive the ciphertext output |
| int genpub | ( | ) |
Generate a public key based on the private key in this object.
| bool hasPrivate | ( | ) | const [inline] |
Predicate used to test whether this object contains a private key.
| bool hasPublic | ( | ) | const [inline] |
Predicate used to test whether this object contains a public key.
| int loadasn1private | ( | const str & | b1 | ) |
Load an ASN.1 DER-encoded private key.
| b1 | the ASN.1 DER-encoded private key to be loaded |
Load a (raw) RSA private key into this object (as a pair of prime factors of the modulus).
| p1 | the first prime | |
| q1 | the second prime |
| int loadpriv | ( | const num & | p1 | ) | [inline] |
Load (raw) RSA private key into this object (as a single prime factor of the modulus).
| p1 | the private key to load into this object. |
| int loadpub | ( | const str & | pubk | ) |
Load an ASN.1 DER-encoded public key.
| pubk | the ASN.1 DER-encoded RSA public key to be loaded |
Load a (raw) RSA public key into this object.
| expo1 | the RSA exponent | |
| pq1 | the RSA modulus |
| int setup | ( | ) |
Derive PKCS#1 RSA private key components from the prime factors of the modulus.
Sign a specified message digest.
| hash | a num containing the hash value to be signed | |
| random | unused (provided for template compatability with Key) | |
| sig | the output buffer to receive the signature | |
| nHashType | algorithm id: hSHA1 or hMD5 (FIPS 140-1 compliant applications must use hSHA1) |
| ISC Cryptographic Development Kit - User's Guide | |
| Questions? E-mail ISC technical support | |
| Copyright© 2002-2006 Information Security Corp. All rights reserved. |