An RsaPublicKeyLite holds a decoded RSA public key for use in crypto operations.
More...
#include <rsa-public-key-lite.hpp>
|
|
| RsaPublicKeyLite () |
| | Create an RsaPublicKeyLite with a null value.
|
| |
|
| ~RsaPublicKeyLite () |
| | Finalize the RsaPublicKeyLite, freeing memory if needed.
|
| |
| ndn_Error | decode (const uint8_t *publicKeyDer, size_t publicKeyDerLength) |
| | Decode the publicKeyDer and set this RsaPublicKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | decode (const BlobLite &publicKeyDer) |
| | Decode the publicKeyDer and set this RsaPublicKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | encode (uint8_t *encoding, size_t &encodingLength) const |
| | Encode the DER-encoded SubjectPublicKeyInfo. More...
|
| |
| bool | verifyWithSha256 (const uint8_t *signature, size_t signatureLength, const uint8_t *data, size_t dataLength) const |
| | Use this public key to verify the data using RsaWithSha256. More...
|
| |
| bool | verifyWithSha256 (const BlobLite &signature, const BlobLite &data) const |
| | Use this public key to verify the data using RsaWithSha256. More...
|
| |
| ndn_Error | encrypt (const uint8_t *plainData, size_t plainDataLength, ndn_EncryptAlgorithmType algorithmType, uint8_t *encryptedData, size_t &encryptedDataLength) const |
| | Use this public key to encrypt plainData according to the algorithmType. More...
|
| |
| ndn_Error | encrypt (const BlobLite &plainData, ndn_EncryptAlgorithmType algorithmType, uint8_t *encryptedData, size_t &encryptedDataLength) const |
| | Use this public key to encrypt plainData according to the algorithmType. More...
|
| |
An RsaPublicKeyLite holds a decoded RSA public key for use in crypto operations.
| ndn_Error ndn::RsaPublicKeyLite::decode |
( |
const uint8_t * |
publicKeyDer, |
|
|
size_t |
publicKeyDerLength |
|
) |
| |
Decode the publicKeyDer and set this RsaPublicKeyLite, allocating memory as needed.
- Parameters
-
| publicKeyDer | A pointer to the DER-encoded public key. |
| publicKeyDerLength | The length of publicKeyDer. |
- Returns
- 0 for success, else NDN_ERROR_Error_decoding_key if publicKeyDer can't be decoded as an RSA public key.
| ndn_Error ndn::RsaPublicKeyLite::decode |
( |
const BlobLite & |
publicKeyDer | ) |
|
|
inline |
Decode the publicKeyDer and set this RsaPublicKeyLite, allocating memory as needed.
- Parameters
-
| publicKeyDer | The DER-encoded public key. |
- Returns
- 0 for success, else NDN_ERROR_Error_decoding_key if publicKeyDer can't be decoded as an RSA public key.
| ndn_Error ndn::RsaPublicKeyLite::encode |
( |
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::RsaPublicKeyLite::encrypt |
( |
const uint8_t * |
plainData, |
|
|
size_t |
plainDataLength, |
|
|
ndn_EncryptAlgorithmType |
algorithmType, |
|
|
uint8_t * |
encryptedData, |
|
|
size_t & |
encryptedDataLength |
|
) |
| const |
Use this public key to encrypt plainData according to the algorithmType.
- Parameters
-
| plainData | A pointer to the input byte array to encrypt. |
| plainDataLength | The length of plainData. |
| algorithmType | This encrypts according to algorithmType. |
| encryptedData | A pointer to the encrypted output buffer. The caller must provide a buffer large enough to receive the bytes. |
| encryptedDataLength | Set encryptedDataLength to the number of bytes placed in the encryptedData buffer. |
- Returns
- 0 for success, else NDN_ERROR_Unsupported_algorithm_type for unsupported algorithmType padding scheme, or NDN_ERROR_Error_in_encrypt_operation if can't complete the encrypt operation.
| ndn_Error ndn::RsaPublicKeyLite::encrypt |
( |
const BlobLite & |
plainData, |
|
|
ndn_EncryptAlgorithmType |
algorithmType, |
|
|
uint8_t * |
encryptedData, |
|
|
size_t & |
encryptedDataLength |
|
) |
| const |
|
inline |
Use this public key to encrypt plainData according to the algorithmType.
- Parameters
-
| plainData | The input byte array to encrypt. |
| algorithmType | This encrypts according to algorithmType. |
| encryptedData | A pointer to the encrypted output buffer. The caller must provide a buffer large enough to receive the bytes. |
| encryptedDataLength | Set encryptedDataLength to the number of bytes placed in the encryptedData buffer. |
- Returns
- 0 for success, else NDN_ERROR_Unsupported_algorithm_type for unsupported algorithmType padding scheme, or NDN_ERROR_Error_in_encrypt_operation if can't complete the encrypt operation.
| static ndn_Error ndn::RsaPublicKeyLite::verifySha256WithRsaSignature |
( |
const uint8_t * |
signature, |
|
|
size_t |
signatureLength, |
|
|
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
const uint8_t * |
publicKeyDer, |
|
|
size_t |
publicKeyDerLength, |
|
|
bool & |
verified |
|
) |
| |
|
static |
Verify the RSA signature of the data using the given public key.
- Parameters
-
| signature | A pointer to the signature bytes. |
| signatureLength | The length of signature. |
| data | A pointer to the input byte array to verify. |
| dataLength | The length of data. |
| publicKeyDer | A pointer to the DER-encoded public key used to verify the signature. |
| publicKeyDerLength | The length of publicKeyDer. |
| verified | Set verified to true if the signature verifies, false if not. |
- Returns
- 0 for success, else NDN_ERROR_Error_decoding_key if publicKeyDer can't be decoded as an RSA public key.
| static ndn_Error ndn::RsaPublicKeyLite::verifySha256WithRsaSignature |
( |
const BlobLite & |
signature, |
|
|
const BlobLite & |
data, |
|
|
const BlobLite & |
publicKeyDer, |
|
|
bool & |
verified |
|
) |
| |
|
inlinestatic |
Verify the RSA signature of the data using the given public key.
- Parameters
-
| signature | The signature bytes. |
| data | The input byte array to verify. |
| publicKeyDer | The DER-encoded public key used to verify the signature. |
| verified | Set verified to true if the signature verifies, false if not. |
- Returns
- 0 for success, else NDN_ERROR_Error_decoding_key if publicKeyDer can't be decoded as an RSA public key.
| bool ndn::RsaPublicKeyLite::verifyWithSha256 |
( |
const uint8_t * |
signature, |
|
|
size_t |
signatureLength, |
|
|
const uint8_t * |
data, |
|
|
size_t |
dataLength |
|
) |
| const |
Use this public key to verify the data using RsaWithSha256.
- Parameters
-
| signature | A pointer to the signature bytes. |
| signatureLength | The length of signature. |
| data | A pointer to the input byte array to verify. |
| dataLength | The length of data. |
- Returns
- True if the signature verifies, false if not.
| bool ndn::RsaPublicKeyLite::verifyWithSha256 |
( |
const BlobLite & |
signature, |
|
|
const BlobLite & |
data |
|
) |
| const |
|
inline |
Use this public key to verify the data using RsaWithSha256.
- Parameters
-
| signature | The signature bytes. |
| data | The input byte array to verify. |
- Returns
- True if the signature verifies, false if not.
The documentation for this class was generated from the following file: