Abstraction of public key in crypto transformation. More...
#include <public-key.hpp>
Classes | |
class | Error |
class | Impl |
Public Member Functions | |
PublicKey () | |
Create an empty public key instance. More... | |
~PublicKey () | |
KeyType | getKeyType () const |
Return the type of the public key. More... | |
size_t | getKeySize () const |
Return the size of the public key in bits. 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... | |
ConstBufferPtr | encrypt (span< const uint8_t > plainText) const |
Friends | |
class | VerifierFilter |
Abstraction of public key in crypto transformation.
Definition at line 35 of file public-key.hpp.
ndn::security::transform::PublicKey::PublicKey | ( | ) |
Create an empty public key instance.
One must call loadXXXX(...)
to load a public key.
Definition at line 64 of file public-key.cpp.
References ~PublicKey().
|
default |
Referenced by PublicKey().
KeyType ndn::security::transform::PublicKey::getKeyType | ( | ) | const |
Return the type of the public key.
Definition at line 72 of file public-key.cpp.
References ndn::EC, ndn::security::detail::getEvpPkeyType(), ndn::NONE, and ndn::RSA.
Referenced by getKeySize(), and ndn::security::pib::detail::KeyImpl::KeyImpl().
size_t ndn::security::transform::PublicKey::getKeySize | ( | ) | const |
Return the size of the public key in bits.
Definition at line 88 of file public-key.cpp.
References ndn::EC, getKeyType(), and ndn::RSA.
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 100 of file public-key.cpp.
References ENSURE_PUBLIC_KEY_NOT_LOADED, and NDN_THROW.
Referenced by ndn::security::pib::detail::KeyImpl::KeyImpl(), loadPkcs8(), loadPkcs8Base64(), ndn::security::v2::KeyChain::makeCertificate(), and ndn::security::verifySignature().
void ndn::security::transform::PublicKey::loadPkcs8 | ( | std::istream & | is | ) |
Load the public key in PKCS#8 format from a stream is
.
Definition at line 110 of file public-key.cpp.
References ndn::OBufferStream::buf(), loadPkcs8(), and ndn::security::transform::streamSink().
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 118 of file public-key.cpp.
References ndn::security::transform::base64Decode(), ndn::OBufferStream::buf(), loadPkcs8(), and ndn::security::transform::streamSink().
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 126 of file public-key.cpp.
References ndn::security::transform::base64Decode(), ndn::OBufferStream::buf(), loadPkcs8(), and ndn::security::transform::streamSink().
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 134 of file public-key.cpp.
References ndn::security::transform::streamSink().
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 140 of file public-key.cpp.
References ndn::security::transform::base64Encode(), and ndn::security::transform::streamSink().
ConstBufferPtr ndn::security::transform::PublicKey::encrypt | ( | span< const uint8_t > | plainText | ) | const |
plainText
encrypted using this public key.Only RSA encryption is supported.
Definition at line 146 of file public-key.cpp.
References ENSURE_PUBLIC_KEY_LOADED, ndn::security::detail::getEvpPkeyType(), NDN_THROW, and ndn::to_string().
|
friend |
Definition at line 111 of file public-key.hpp.