22 #ifndef NDN_EC_PUBLIC_KEY_LITE_HPP
23 #define NDN_EC_PUBLIC_KEY_LITE_HPP
25 #include "../util/blob-lite.hpp"
26 #include "../../c/errors.h"
27 #include "../../c/security/ec-public-key-types.h"
55 decode(
const uint8_t* publicKeyDer,
size_t publicKeyDerLength);
84 encode(
bool includeParameters, uint8_t* encoding,
size_t& encodingLength)
const;
96 (
const uint8_t *signature,
size_t signatureLength,
const uint8_t *data,
97 size_t dataLength)
const;
127 (
const uint8_t *signature,
size_t signatureLength,
const uint8_t *data,
128 size_t dataLength,
const uint8_t *publicKeyDer,
size_t publicKeyDerLength,
143 const BlobLite& publicKeyDer,
bool &verified)
147 publicKeyDer.
buf(), publicKeyDer.
size(), verified);
size_t size() const
Return size given to the constructor.
Definition: blob-lite.hpp:61
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
ndn_Error decode(const uint8_t *publicKeyDer, size_t publicKeyDerLength)
Decode the publicKeyDer and set this EcPublicKeyLite, allocating memory as needed.
Definition: ec-public-key-lite.cpp:39
An EcPublicKeyLite holds a decoded EC public key for use in crypto operations.
Definition: ec-public-key-lite.hpp:34
ndn_Error encode(bool includeParameters, uint8_t *encoding, size_t &encodingLength) const
Encode the DER-encoded EC SubjectPublicKeyInfo.
Definition: ec-public-key-lite.cpp:46
bool verifyWithSha256(const BlobLite &signature, const BlobLite &data) const
Use this public key to verify the data using EcdsaWithSha256.
Definition: ec-public-key-lite.hpp:106
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.
Definition: ec-public-key-lite.cpp:54
~EcPublicKeyLite()
Finalize the EcPublicKeyLite, freeing memory if needed.
Definition: ec-public-key-lite.cpp:32
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 BlobLite &publicKeyDer)
Decode the publicKeyDer and set this EcPublicKeyLite, allocating memory as needed.
Definition: ec-public-key-lite.hpp:65
A struct ndn_EcPublicKey holds a decoded EC public key for use in crypto operations.
Definition: ec-public-key-types.h:34
static EcPublicKeyLite & downCast(ndn_EcPublicKey &blob)
Downcast the reference to the ndn_EcPublicKey struct to a EcPublicKeyLite.
Definition: ec-public-key-lite.hpp:156
static ndn_Error verifySha256WithEcdsaSignature(const uint8_t *signature, size_t signatureLength, const uint8_t *data, size_t dataLength, const uint8_t *publicKeyDer, size_t publicKeyDerLength, bool &verified)
Verify the ECDSA signature of the data using the given public key.
Definition: ec-public-key-lite.cpp:63
EcPublicKeyLite()
Create an EcPublicKeyLite with a null value.
Definition: ec-public-key-lite.cpp:27