ndn::security::transform::PublicKey Class Reference

Abstraction of a public key in crypto transformations. More...

#include <ndn-cxx/security/transform/public-key.hpp>

+ Inheritance diagram for ndn::security::transform::PublicKey:
+ Collaboration diagram for ndn::security::transform::PublicKey:

Classes

class  Error
 

Public Member Functions

 PublicKey ()
 Create an empty public key instance. More...
 
 ~PublicKey ()
 
ConstBufferPtr encrypt (span< const uint8_t > plainText) const
 
size_t getKeySize () const
 Return the size of the public key in bits. More...
 
KeyType getKeyType () const
 Return the type of the public key. More...
 
void loadPkcs8 (span< const uint8_t > buf)
 Load the public key in PKCS#8 format from a buffer buf. More...
 
void loadPkcs8 (std::istream &is)
 Load the public key in PKCS#8 format from a stream is. More...
 
void loadPkcs8Base64 (span< const uint8_t > buf)
 Load the public key in base64-encoded PKCS#8 format from a buffer buf. More...
 
void loadPkcs8Base64 (std::istream &is)
 Load the public key in base64-encoded PKCS#8 format from a stream is. More...
 
void savePkcs8 (std::ostream &os) const
 Save the public key in PKCS#8 format into a stream os. More...
 
void savePkcs8Base64 (std::ostream &os) const
 Save the public key in base64-encoded PKCS#8 format into a stream os. More...
 

Friends

class VerifierFilter
 

Detailed Description

Abstraction of a public key in crypto transformations.

Definition at line 34 of file public-key.hpp.

Constructor & Destructor Documentation

◆ PublicKey()

ndn::security::transform::PublicKey::PublicKey ( )

Create an empty public key instance.

One must call loadXXXX(...) to load a public key.

Definition at line 65 of file public-key.cpp.

◆ ~PublicKey()

ndn::security::transform::PublicKey::~PublicKey ( )
default

Member Function Documentation

◆ encrypt()

ConstBufferPtr ndn::security::transform::PublicKey::encrypt ( span< const uint8_t >  plainText) const
Returns
Cipher text of plainText encrypted using this public key.

Only RSA encryption is supported.

Definition at line 147 of file public-key.cpp.

◆ getKeySize()

size_t ndn::security::transform::PublicKey::getKeySize ( ) const

Return the size of the public key in bits.

Definition at line 89 of file public-key.cpp.

◆ getKeyType()

KeyType ndn::security::transform::PublicKey::getKeyType ( ) const

Return the type of the public key.

Definition at line 73 of file public-key.cpp.

◆ loadPkcs8() [1/2]

void ndn::security::transform::PublicKey::loadPkcs8 ( span< const uint8_t >  buf)

Load the public key in PKCS#8 format from a buffer buf.

Definition at line 101 of file public-key.cpp.

◆ loadPkcs8() [2/2]

void ndn::security::transform::PublicKey::loadPkcs8 ( std::istream &  is)

Load the public key in PKCS#8 format from a stream is.

Definition at line 111 of file public-key.cpp.

◆ loadPkcs8Base64() [1/2]

void ndn::security::transform::PublicKey::loadPkcs8Base64 ( span< const uint8_t >  buf)

Load the public key in base64-encoded PKCS#8 format from a buffer buf.

Definition at line 119 of file public-key.cpp.

◆ loadPkcs8Base64() [2/2]

void ndn::security::transform::PublicKey::loadPkcs8Base64 ( std::istream &  is)

Load the public key in base64-encoded PKCS#8 format from a stream is.

Definition at line 127 of file public-key.cpp.

◆ savePkcs8()

void ndn::security::transform::PublicKey::savePkcs8 ( std::ostream &  os) const

Save the public key in PKCS#8 format into a stream os.

Definition at line 135 of file public-key.cpp.

◆ savePkcs8Base64()

void ndn::security::transform::PublicKey::savePkcs8Base64 ( std::ostream &  os) const

Save the public key in base64-encoded PKCS#8 format into a stream os.

Definition at line 141 of file public-key.cpp.

Friends And Related Function Documentation

◆ VerifierFilter

friend class VerifierFilter
friend

Definition at line 110 of file public-key.hpp.