An EcPublicKeyLite holds a decoded EC public key for use in crypto operations.
More...
#include <ec-public-key-lite.hpp>
|
|
| EcPublicKeyLite () |
| | Create an EcPublicKeyLite with a null value.
|
| |
|
| ~EcPublicKeyLite () |
| | Finalize the EcPublicKeyLite, freeing memory if needed.
|
| |
| ndn_Error | decode (const uint8_t *publicKeyDer, size_t publicKeyDerLength) |
| | Decode the publicKeyDer and set this EcPublicKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | decode (const BlobLite &publicKeyDer) |
| | Decode the publicKeyDer and set this EcPublicKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | encode (bool includeParameters, uint8_t *encoding, size_t &encodingLength) const |
| | Encode the DER-encoded EC 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 EcdsaWithSha256. More...
|
| |
| bool | verifyWithSha256 (const BlobLite &signature, const BlobLite &data) const |
| | Use this public key to verify the data using EcdsaWithSha256. More...
|
| |
An EcPublicKeyLite holds a decoded EC public key for use in crypto operations.
| ndn_Error ndn::EcPublicKeyLite::decode |
( |
const uint8_t * |
publicKeyDer, |
|
|
size_t |
publicKeyDerLength |
|
) |
| |
Decode the publicKeyDer and set this EcPublicKeyLite, 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 EC public key.
| ndn_Error ndn::EcPublicKeyLite::decode |
( |
const BlobLite & |
publicKeyDer | ) |
|
|
inline |
Decode the publicKeyDer and set this EcPublicKeyLite, 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 EC public key.
| ndn_Error ndn::EcPublicKeyLite::encode |
( |
bool |
includeParameters, |
|
|
uint8_t * |
encoding, |
|
|
size_t & |
encodingLength |
|
) |
| const |
Encode the DER-encoded EC SubjectPublicKeyInfo.
- Parameters
-
| includeParameters | If true, then include the EC parameters in the encoding. |
| 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.
| static ndn_Error ndn::EcPublicKeyLite::verifySha256WithEcdsaSignature |
( |
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 ECDSA 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 ECDSA public key.
| static ndn_Error ndn::EcPublicKeyLite::verifySha256WithEcdsaSignature |
( |
const BlobLite & |
signature, |
|
|
const BlobLite & |
data, |
|
|
const BlobLite & |
publicKeyDer, |
|
|
bool & |
verified |
|
) |
| |
|
inlinestatic |
Verify the ECDSA 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 ECDSA public key.
| bool ndn::EcPublicKeyLite::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 EcdsaWithSha256.
- 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::EcPublicKeyLite::verifyWithSha256 |
( |
const BlobLite & |
signature, |
|
|
const BlobLite & |
data |
|
) |
| const |
|
inline |
Use this public key to verify the data using EcdsaWithSha256.
- 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: