NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::security::transform::PublicKey Class Reference

Abstraction of public key in crypto transformation. More...

#include <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 a public key instance. More...
 
 ~PublicKey ()
 
KeyType getKeyType () const
 Get the type of the public key. More...
 
void loadPkcs8 (const uint8_t *buf, size_t size)
 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 (const uint8_t *buf, size_t size)
 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...
 
ConstBufferPtr encrypt (const uint8_t *plainText, size_t plainLen) const
 

Friends

class VerifierFilter
 

Detailed Description

Abstraction of public key in crypto transformation.

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

Constructor & Destructor Documentation

◆ PublicKey()

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

Create a public key instance.

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

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

References ~PublicKey().

◆ ~PublicKey()

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

Referenced by PublicKey().

Member Function Documentation

◆ getKeyType()

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

Get the type of the public key.

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

References ndn::EC, ENSURE_PUBLIC_KEY_LOADED, and ndn::RSA.

◆ loadPkcs8() [1/2]

void ndn::security::transform::PublicKey::loadPkcs8 ( const uint8_t *  buf,
size_t  size 
)

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

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

References ENSURE_PUBLIC_KEY_LOADED.

Referenced by loadPkcs8(), and loadPkcs8Base64().

◆ 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 93 of file public-key.cpp.

References ndn::OBufferStream::buf(), loadPkcs8(), and ndn::security::transform::streamSink().

◆ loadPkcs8Base64() [1/2]

void ndn::security::transform::PublicKey::loadPkcs8Base64 ( const uint8_t *  buf,
size_t  size 
)

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

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

References ndn::security::transform::base64Decode(), ndn::OBufferStream::buf(), loadPkcs8(), and ndn::security::transform::streamSink().

◆ 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 115 of file public-key.cpp.

References ndn::security::transform::base64Decode(), ndn::OBufferStream::buf(), loadPkcs8(), and ndn::security::transform::streamSink().

◆ 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 126 of file public-key.cpp.

References ndn::security::transform::streamSink().

◆ 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 133 of file public-key.cpp.

References ndn::security::transform::base64Encode(), and ndn::security::transform::streamSink().

◆ encrypt()

ConstBufferPtr ndn::security::transform::PublicKey::encrypt ( const uint8_t *  plainText,
size_t  plainLen 
) const
Returns
Cipher text of plainText encrypted using the public key.

Only RSA encryption is supported for now.

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

References ENSURE_PUBLIC_KEY_LOADED, and ndn::security::detail::EvpPkeyCtx::get().

Friends And Related Function Documentation

◆ VerifierFilter

friend class VerifierFilter
friend

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


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