22 #ifndef NDN_CXX_SECURITY_TRANSFORM_PRIVATE_KEY_HPP
23 #define NDN_CXX_SECURITY_TRANSFORM_PRIVATE_KEY_HPP
33 namespace security::transform {
41 class Error :
public std::runtime_error
44 using std::runtime_error::runtime_error;
55 using PasswordCallback = std::function<int(
char* buf,
size_t bufSize,
bool shouldConfirm)>;
124 loadPkcs8(span<const uint8_t> buf,
const char* pw,
size_t pwLen);
140 loadPkcs8(std::istream& is,
const char* pw,
size_t pwLen);
157 loadPkcs8Base64(span<const uint8_t> buf,
const char* pw,
size_t pwLen);
201 savePkcs8(std::ostream& os,
const char* pw,
size_t pwLen)
const;
239 decrypt(span<const uint8_t> cipherText)
const;
257 toPkcs8(
const char* pw,
size_t pwLen)
const;
263 rsaDecrypt(span<const uint8_t> cipherText)
const;
268 static unique_ptr<PrivateKey>
269 generateRsaKey(uint32_t keySize);
271 static unique_ptr<PrivateKey>
272 generateEcKey(uint32_t keySize);
274 static unique_ptr<PrivateKey>
275 generateHmacKey(uint32_t keySize);
279 const unique_ptr<Impl> m_impl;
290 unique_ptr<PrivateKey>
Base class for key parameters.
Common includes and macros used throughout the library.
KeyType
The type of a cryptographic key.
std::shared_ptr< const Buffer > ConstBufferPtr