esp8266ndn
NDN Arduino library for ESP8266 and more
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
ndnph::ec::EcPublicKey Class Reference

EC public key. More...

#include <ec.hpp>

Inherits ndnph::detail::NamedPublicKey< SigType::Sha256WithEcdsa >.

Public Types

using KeyLen = detail::PubLen
 

Public Member Functions

 operator bool () const
 Determine if this key is non-empty. More...
 
bool import (const Name &name, const uint8_t raw[KeyLen::value])
 Import from raw key bits. More...
 
bool import (Region &region, const Data &data)
 Import a public key from certificate. More...
 
template<typename Signer >
Data::Signed buildCertificate (Region &region, const Name &name, const ValidityPeriod &validity, const Signer &signer) const
 Generate certificate of this public key. More...
 
template<typename Signer >
Data::Signed selfSign (Region &region, const ValidityPeriod &validity, const Signer &signer) const
 Generate self-signed certificate of this public key. More...
 
bool verify (std::initializer_list< tlv::Value > chunks, const uint8_t *sig, size_t sigLen) const final
 Perform verification. More...
 
- Public Member Functions inherited from ndnph::detail::NamedPublicKey< SigType::Sha256WithEcdsa >
bool matchSigInfo (const SigInfo &sigInfo) const override
 Determine whether packet was signed by corresponding private key. More...
 
- Public Member Functions inherited from ndnph::PublicKey
virtual ~PublicKey ()=default
 
- Public Member Functions inherited from ndnph::detail::NamedKey
const NamegetName () const
 Retrieve KeyLocator name. More...
 
void setName (const Name &v)
 Assign KeyLocator name. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ndnph::detail::NamedKey
 ~NamedKey ()=default
 

Detailed Description

EC public key.

Member Typedef Documentation

◆ KeyLen

Member Function Documentation

◆ buildCertificate()

template<typename Signer >
Data::Signed ndnph::ec::EcPublicKey::buildCertificate ( Region region,
const Name name,
const ValidityPeriod validity,
const Signer &  signer 
) const
inline

Generate certificate of this public key.

Parameters
namekey name or certificate name.
validitycertificate validity period.
signercertificate issuer.
Returns
result object supporting explicit conversion to bool and equipped with a `void encodeTo(Encoder&) const` method. `!result` indicates the operation has failed. Encodable object is valid only if arguments to this function are kept alive.

◆ import() [1/2]

bool ndnph::ec::EcPublicKey::import ( const Name name,
const uint8_t  raw[KeyLen::value] 
)
inline

Import from raw key bits.

Parameters
namekey name; will be referenced.
rawraw key bits; will be copied.
Returns
whether success.

◆ import() [2/2]

bool ndnph::ec::EcPublicKey::import ( Region region,
const Data data 
)
inline

Import a public key from certificate.

Parameters
regionwhere to copy key name.
datacertificate; it can be freed after this operation.
Returns
whether success.

◆ operator bool()

ndnph::ec::EcPublicKey::operator bool ( ) const
inlineexplicit

Determine if this key is non-empty.

◆ selfSign()

template<typename Signer >
Data::Signed ndnph::ec::EcPublicKey::selfSign ( Region region,
const ValidityPeriod validity,
const Signer &  signer 
) const
inline

Generate self-signed certificate of this public key.

Parameters
validitycertificate validity period.
signercorresponding private key.
Returns
result object supporting explicit conversion to bool and equipped with a `void encodeTo(Encoder&) const` method. `!result` indicates the operation has failed. Encodable object is valid only if arguments to this function are kept alive.

◆ verify()

bool ndnph::ec::EcPublicKey::verify ( std::initializer_list< tlv::Value chunks,
const uint8_t *  sig,
size_t  sigLen 
) const
inlinefinalvirtual

Perform verification.

Return values
truesignature is correct.
falseerror or signature is incorrect.

Implements ndnph::PublicKey.


The documentation for this class was generated from the following file: