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"
37 struct ec_key_st* debugGetPrivateKey() {
return this->privateKey; }
58 decode(
const uint8_t* privateKeyDer,
size_t privateKeyDerLength);
83 setByCurve(
int curveId,
const uint8_t* value,
size_t valueLength);
125 (
bool includeParameters, uint8_t* encoding,
size_t& encodingLength)
const;
142 (
bool includeParameters, uint8_t* encoding,
size_t& encodingLength)
const;
157 (
const uint8_t* data,
size_t dataLength, uint8_t* signature,
158 size_t& signatureLength)
const;
172 (
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:183
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
EcPrivateKeyLite()
Create an EcPrivateKeyLite with a null value.
Definition: ec-private-key-lite.cpp:27
ndn_Error encodePrivateKey(bool includeParameters, uint8_t *encoding, size_t &encodingLength) const
Encode the DER-encoded private key.
Definition: ec-private-key-lite.cpp:59
ndn_Error decode(const BlobLite &privateKeyDer)
Decode the privateKeyDer and set this EcPrivateKeyLite, allocating memory as needed.
Definition: ec-private-key-lite.hpp:68
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:94
~EcPrivateKeyLite()
Finalize the EcPrivateKeyLite, freeing memory if needed.
Definition: ec-private-key-lite.cpp:32
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.
Definition: ec-private-key-lite.cpp:75
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.
Definition: ec-private-key-lite.cpp:52
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 decode(const uint8_t *privateKeyDer, size_t privateKeyDerLength)
Decode the privateKeyDer and set this EcPrivateKeyLite, allocating memory as needed.
Definition: ec-private-key-lite.cpp:39
ndn_Error encodePublicKey(bool includeParameters, uint8_t *encoding, size_t &encodingLength) const
Encode the DER-encoded EC SubjectPublicKeyInfo.
Definition: ec-private-key-lite.cpp:67
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.
Definition: ec-private-key-lite.cpp:46