22 #ifndef NDN_CXX_SECURITY_TRANSFORM_PRIVATE_KEY_HPP
23 #define NDN_CXX_SECURITY_TRANSFORM_PRIVATE_KEY_HPP
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)>;
101 [[deprecated(
"use the overload that takes a span<>")]]
118 [[deprecated(
"use the overload that takes a span<>")]]
141 [[deprecated(
"use the overload that takes a span<>")]]
159 loadPkcs8(span<const uint8_t> buf,
const char* pw,
size_t pwLen);
177 [[deprecated(
"use the overload that takes a span<>")]]
181 loadPkcs8({buf, size}, std::move(pwCallback));
189 loadPkcs8(std::istream& is,
const char* pw,
size_t pwLen);
206 loadPkcs8Base64(span<const uint8_t> buf,
const char* pw,
size_t pwLen);
224 [[deprecated(
"use the overload that takes a span<>")]]
264 savePkcs8(std::ostream& os,
const char* pw,
size_t pwLen)
const;
302 decrypt(span<const uint8_t> cipherText)
const;
310 [[deprecated(
"use the overload that takes a span<>")]]
312 decrypt(
const uint8_t* cipherText,
size_t cipherLen)
const
314 return decrypt({cipherText, cipherLen});
334 toPkcs8(
const char* pw,
size_t pwLen)
const;
340 rsaDecrypt(span<const uint8_t> cipherText)
const;
345 static unique_ptr<PrivateKey>
346 generateRsaKey(uint32_t keySize);
348 static unique_ptr<PrivateKey>
349 generateEcKey(uint32_t keySize);
351 static unique_ptr<PrivateKey>
352 generateHmacKey(uint32_t keySize);
356 const unique_ptr<Impl> m_impl;
367 unique_ptr<PrivateKey>
Base class for key parameters.
shared_ptr< const Buffer > ConstBufferPtr
KeyType
The type of a cryptographic key.