An RsaPrivateKeyLite holds a decoded or generated RSA private key for use in crypto operations.
More...
#include <rsa-private-key-lite.hpp>
|
|
| RsaPrivateKeyLite () |
| | Create an RsaPrivateKeyLite with a null value.
|
| |
|
| ~RsaPrivateKeyLite () |
| | Finalize the RsaPrivateKeyLite, freeing memory if needed.
|
| |
| ndn_Error | decode (const uint8_t *privateKeyDer, size_t privateKeyDerLength) |
| | Decode the DER-encoded PKCS #1 privateKeyDer and set this RsaPrivateKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | decode (const BlobLite &privateKeyDer) |
| | Decode the DER-encoded PKCS #1 privateKeyDer and set this RsaPrivateKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | generate (uint32_t keySize) |
| | Generate a key pair and set this RsaPrivateKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | encodePrivateKey (uint8_t *encoding, size_t &encodingLength) const |
| | Encode the DER-encoded PKCS #1 private key. More...
|
| |
| ndn_Error | encodePublicKey (uint8_t *encoding, size_t &encodingLength) const |
| | Encode the DER-encoded SubjectPublicKeyInfo. More...
|
| |
| ndn_Error | signWithSha256 (const uint8_t *data, size_t dataLength, uint8_t *signature, size_t &signatureLength) const |
| | Use this private key to sign the data using RsaWithSha256. More...
|
| |
| ndn_Error | signWithSha256 (const BlobLite &data, uint8_t *signature, size_t &signatureLength) const |
| | Use this private key to sign the data using RsaWithSha256. More...
|
| |
| ndn_Error | decrypt (const uint8_t *encryptedData, size_t encryptedDataLength, ndn_EncryptAlgorithmType algorithmType, uint8_t *plainData, size_t &plainDataLength) |
| | Use the private key to decrypt encryptedData according to the algorithmType. More...
|
| |
| ndn_Error | decrypt (const BlobLite &encryptedData, ndn_EncryptAlgorithmType algorithmType, uint8_t *plainData, size_t &plainDataLength) |
| | Use the private key to decrypt encryptedData according to the algorithmType. More...
|
| |
An RsaPrivateKeyLite holds a decoded or generated RSA private key for use in crypto operations.
| ndn_Error ndn::RsaPrivateKeyLite::decode |
( |
const uint8_t * |
privateKeyDer, |
|
|
size_t |
privateKeyDerLength |
|
) |
| |
Decode the DER-encoded PKCS #1 privateKeyDer and set this RsaPrivateKeyLite, allocating memory as needed.
- Parameters
-
| privateKeyDer | A pointer to the DER-encoded private key. |
| privateKeyDerLength | The length of privateKeyDer. |
- Returns
- 0 for success, else NDN_ERROR_Error_decoding_key if privateKeyDer can't be decoded as an RSA private key.
| ndn_Error ndn::RsaPrivateKeyLite::decode |
( |
const BlobLite & |
privateKeyDer | ) |
|
|
inline |
Decode the DER-encoded PKCS #1 privateKeyDer and set this RsaPrivateKeyLite, allocating memory as needed.
- Parameters
-
| privateKeyDer | The DER-encoded private key. |
- Returns
- 0 for success, else NDN_ERROR_Error_decoding_key if privateKeyDer can't be decoded as an RSA private key.
| ndn_Error ndn::RsaPrivateKeyLite::decrypt |
( |
const uint8_t * |
encryptedData, |
|
|
size_t |
encryptedDataLength, |
|
|
ndn_EncryptAlgorithmType |
algorithmType, |
|
|
uint8_t * |
plainData, |
|
|
size_t & |
plainDataLength |
|
) |
| |
Use the private key to decrypt encryptedData according to the algorithmType.
- Parameters
-
| encryptedData | A pointer to the input byte array to decrypt. |
| encryptedDataLength | The length of encryptedData. |
| algorithmType | This decrypts according to algorithmType. |
| plainData | A pointer to the decrypted output buffer. The caller must provide a buffer large enough to receive the bytes. |
| plainDataLength | Set plainDataLength to the number of bytes placed in the plainData buffer. |
- Returns
- 0 for success, else NDN_ERROR_Unsupported_algorithm_type for unsupported algorithmType padding scheme, or NDN_ERROR_Error_in_decrypt_operation if can't complete the decrypt operation.
| ndn_Error ndn::RsaPrivateKeyLite::decrypt |
( |
const BlobLite & |
encryptedData, |
|
|
ndn_EncryptAlgorithmType |
algorithmType, |
|
|
uint8_t * |
plainData, |
|
|
size_t & |
plainDataLength |
|
) |
| |
|
inline |
Use the private key to decrypt encryptedData according to the algorithmType.
- Parameters
-
| encryptedData | The input byte array to decrypt. |
| algorithmType | This decrypts according to algorithmType. |
| plainData | A pointer to the decrypted output buffer. The caller must provide a buffer large enough to receive the bytes. |
| plainDataLength | Set plainDataLength to the number of bytes placed in the plainData buffer. |
- Returns
- 0 for success, else NDN_ERROR_Unsupported_algorithm_type for unsupported algorithmType padding scheme, or NDN_ERROR_Error_in_decrypt_operation if can't complete the decrypt operation.
| ndn_Error ndn::RsaPrivateKeyLite::encodePrivateKey |
( |
uint8_t * |
encoding, |
|
|
size_t & |
encodingLength |
|
) |
| const |
Encode the DER-encoded PKCS #1 private key.
- Parameters
-
| encoding | A pointer to the encoding output buffer. If this is null then only set encodingLength (which can be used to allocate a buffer of the correct size). Otherwise, the caller must provide a buffer large enough to receive the encoding bytes. |
| encodingLength | Set encodingLength to the number of bytes in the encoding. |
- Returns
- 0 for success, else NDN_ERROR_Error_encoding_key if can't encode the key.
| ndn_Error ndn::RsaPrivateKeyLite::encodePublicKey |
( |
uint8_t * |
encoding, |
|
|
size_t & |
encodingLength |
|
) |
| const |
Encode the DER-encoded SubjectPublicKeyInfo.
- Parameters
-
| encoding | A pointer to the encoding output buffer. If this is null then only set encodingLength (which can be used to allocate a buffer of the correct size). Otherwise, the caller must provide a buffer large enough to receive the encoding bytes. |
| encodingLength | Set encodingLength to the number of bytes in the encoding. |
- Returns
- 0 for success, else NDN_ERROR_Error_encoding_key if can't encode the key.
| ndn_Error ndn::RsaPrivateKeyLite::generate |
( |
uint32_t |
keySize | ) |
|
Generate a key pair and set this RsaPrivateKeyLite, allocating memory as needed.
- Parameters
-
| keySize | The size in bits of the key to generate. |
- Returns
- 0 for success, else NDN_ERROR_Error_in_generate_operation if can't complete the generate operation.
| ndn_Error ndn::RsaPrivateKeyLite::signWithSha256 |
( |
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
uint8_t * |
signature, |
|
|
size_t & |
signatureLength |
|
) |
| const |
Use this private key to sign the data using RsaWithSha256.
- Parameters
-
| data | A pointer to the input byte array to sign. |
| dataLength | The length of data. |
| signature | A pointer to the signature output buffer. The caller must provide a buffer large enough to receive the signature bytes. |
| signatureLength | Set signatureLength to the number of bytes placed in the signature buffer. |
- Returns
- 0 for success, else NDN_ERROR_Error_in_sign_operation if can't complete the sign operation.
| ndn_Error ndn::RsaPrivateKeyLite::signWithSha256 |
( |
const BlobLite & |
data, |
|
|
uint8_t * |
signature, |
|
|
size_t & |
signatureLength |
|
) |
| const |
|
inline |
Use this private key to sign the data using RsaWithSha256.
- Parameters
-
| data | The input byte array to sign. |
| signature | A pointer to the signature output buffer. The caller must provide a buffer large enough to receive the signature bytes. |
| signatureLength | Set signatureLength to the number of bytes placed in the signature buffer. |
- Returns
- 0 for success, else NDN_ERROR_Error_in_sign_operation if can't complete the sign operation.
The documentation for this class was generated from the following file: