22 #ifndef NDN_EC_PRIVATE_KEY_LITE_HPP
23 #define NDN_EC_PRIVATE_KEY_LITE_HPP
25 #include "../util/blob-lite.hpp"
26 #include "../../c/errors.h"
27 #include "../../c/security/ec-private-key-types.h"
56 decode(
const uint8_t* privateKeyDer,
size_t privateKeyDerLength);
81 setByCurve(
int curveId,
const uint8_t* value,
size_t valueLength);
123 (
bool includeParameters, uint8_t* encoding,
size_t& encodingLength)
const;
140 (
bool includeParameters, uint8_t* encoding,
size_t& encodingLength)
const;
155 (
const uint8_t* data,
size_t dataLength, uint8_t* signature,
156 size_t& signatureLength)
const;
170 (
const BlobLite& data, uint8_t* signature,
size_t& signatureLength)
const
A struct ndn_EcPrivateKey holds a decoded EC private key for use in crypto operations.
Definition: ec-private-key-types.h:34
size_t size() const
Return size given to the constructor.
Definition: blob-lite.hpp:61
static EcPrivateKeyLite & downCast(ndn_EcPrivateKey &blob)
Downcast the reference to the ndn_EcPrivateKey struct to a EcPrivateKeyLite.
Definition: ec-private-key-lite.hpp:190
EcPrivateKeyLite()
Create an EcPrivateKeyLite with a null value.
ndn_Error encodePrivateKey(bool includeParameters, uint8_t *encoding, size_t &encodingLength) const
Encode the DER-encoded private key.
ndn_Error decode(const BlobLite &privateKeyDer)
Decode the privateKeyDer and set this EcPrivateKeyLite, allocating memory as needed.
Definition: ec-private-key-lite.hpp:66
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.
Definition: ec-private-key-lite.hpp:92
~EcPrivateKeyLite()
Finalize the EcPrivateKeyLite, freeing memory if needed.
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.
An EcPrivateKeyLite holds a decoded or generated EC private key for use in crypto operations...
Definition: ec-private-key-lite.hpp:35
ndn_Error generate(uint32_t keySize)
Generate a key pair and set this EcPrivateKeyLite, allocating memory as needed.
A BlobLite holds a pointer to an immutable pre-allocated buffer and its length This is like a JavaScr...
Definition: blob-lite.hpp:37
const uint8_t * buf() const
Return buf given to the constructor.
Definition: blob-lite.hpp:55
ndn_Error getCurveId(int &curveId) const
Get the OpenSSL curve ID.
ndn_Error decode(const uint8_t *privateKeyDer, size_t privateKeyDerLength)
Decode the privateKeyDer and set this EcPrivateKeyLite, allocating memory as needed.
ndn_Error encodePublicKey(bool includeParameters, uint8_t *encoding, size_t &encodingLength) const
Encode the DER-encoded EC SubjectPublicKeyInfo.
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.