An EcPrivateKeyLite holds a decoded or generated EC private key for use in crypto operations.
More...
#include <ec-private-key-lite.hpp>
|
|
| EcPrivateKeyLite () |
| | Create an EcPrivateKeyLite with a null value.
|
| |
|
| ~EcPrivateKeyLite () |
| | Finalize the EcPrivateKeyLite, freeing memory if needed.
|
| |
| ndn_Error | decode (const uint8_t *privateKeyDer, size_t privateKeyDerLength) |
| | Decode the privateKeyDer and set this EcPrivateKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | decode (const BlobLite &privateKeyDer) |
| | Decode the privateKeyDer and set this EcPrivateKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | setByCurve (int curveId, const uint8_t *value, size_t valueLength) |
| | Set the the private key from the given curveId, using the value to create a BIGNUM, allocating memory as needed. More...
|
| |
| ndn_Error | setByCurve (int curveId, const BlobLite &value) |
| | Set the the private key from the given curveId, using the value to create a BIGNUM, allocating memory as needed. More...
|
| |
| ndn_Error | generate (uint32_t keySize) |
| | Generate a key pair and set this EcPrivateKeyLite, allocating memory as needed. More...
|
| |
| ndn_Error | encodePrivateKey (bool includeParameters, uint8_t *encoding, size_t &encodingLength) const |
| | Encode the DER-encoded private key. More...
|
| |
| ndn_Error | encodePublicKey (bool includeParameters, uint8_t *encoding, size_t &encodingLength) const |
| | Encode the DER-encoded EC 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 EcdsaWithSha256. More...
|
| |
| ndn_Error | signWithSha256 (const BlobLite &data, uint8_t *signature, size_t &signatureLength) const |
| | Use this private key to sign the data using EcdsaWithSha256. More...
|
| |
| ndn_Error | getCurveId (int &curveId) const |
| | Get the OpenSSL curve ID. More...
|
| |
|
|
struct ec_key_st * | privateKey |
| |
An EcPrivateKeyLite holds a decoded or generated EC private key for use in crypto operations.
| ndn_Error ndn::EcPrivateKeyLite::decode |
( |
const uint8_t * |
privateKeyDer, |
|
|
size_t |
privateKeyDerLength |
|
) |
| |
Decode the privateKeyDer and set this EcPrivateKeyLite, 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 EC private key.
| ndn_Error ndn::EcPrivateKeyLite::decode |
( |
const BlobLite & |
privateKeyDer | ) |
|
|
inline |
Decode the privateKeyDer and set this EcPrivateKeyLite, 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 EC private key.
| ndn_Error ndn::EcPrivateKeyLite::encodePrivateKey |
( |
bool |
includeParameters, |
|
|
uint8_t * |
encoding, |
|
|
size_t & |
encodingLength |
|
) |
| const |
Encode the DER-encoded private key.
- 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.
| ndn_Error ndn::EcPrivateKeyLite::encodePublicKey |
( |
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.
| ndn_Error ndn::EcPrivateKeyLite::generate |
( |
uint32_t |
keySize | ) |
|
Generate a key pair and set this EcPrivateKeyLite, 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, including if a curve can't be found for the keySize.
| ndn_Error ndn::EcPrivateKeyLite::getCurveId |
( |
int & |
curveId | ) |
const |
Get the OpenSSL curve ID.
- Parameters
-
| curveId | Set curveId to the OpenSSL curve ID such as NID_secp384r1. |
- Returns
- 0 for success, else NDN_ERROR_Error_decoding_key if can't get the curve ID.
| ndn_Error ndn::EcPrivateKeyLite::setByCurve |
( |
int |
curveId, |
|
|
const uint8_t * |
value, |
|
|
size_t |
valueLength |
|
) |
| |
Set the the private key from the given curveId, using the value to create a BIGNUM, allocating memory as needed.
- Parameters
-
| curveId | The OpenSSL curve ID such as NID_secp384r1. |
| value | A pointer to the value array for the BIGNUM. |
| valueLength | The length of value. |
- Returns
- 0 for success, else NDN_ERROR_Error_decoding_key if can't create the private key from the curveId or value.
| ndn_Error ndn::EcPrivateKeyLite::setByCurve |
( |
int |
curveId, |
|
|
const BlobLite & |
value |
|
) |
| |
|
inline |
Set the the private key from the given curveId, using the value to create a BIGNUM, allocating memory as needed.
- Parameters
-
| curveId | The OpenSSL curve ID such as NID_secp384r1. |
| value | The value array for the BIGNUM. |
- Returns
- 0 for success, else NDN_ERROR_Error_decoding_key if can't create the private key from the curveId or value.
| ndn_Error ndn::EcPrivateKeyLite::signWithSha256 |
( |
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
uint8_t * |
signature, |
|
|
size_t & |
signatureLength |
|
) |
| const |
Use this private key to sign the data using EcdsaWithSha256.
- 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::EcPrivateKeyLite::signWithSha256 |
( |
const BlobLite & |
data, |
|
|
uint8_t * |
signature, |
|
|
size_t & |
signatureLength |
|
) |
| const |
|
inline |
Use this private key to sign the data using EcdsaWithSha256.
- 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: