22 #ifndef NDN_CXX_SECURITY_KEY_PARAMS_HPP
23 #define NDN_CXX_SECURITY_KEY_PARAMS_HPP
38 class Error :
public std::runtime_error
41 using std::runtime_error::runtime_error;
148 template<
typename KeyParamsInfo>
155 uint32_t size = KeyParamsInfo::getDefaultSize())
156 :
KeyParams(KeyParamsInfo::getType(), keyId)
170 :
KeyParams(KeyParamsInfo::getType(), keyIdType)
183 setKeySize(uint32_t size)
185 m_size = KeyParamsInfo::checkKeySize(size);
189 getDefaultKeySize()
const
191 return KeyParamsInfo::getDefaultSize();
255 template<
typename KeyParamsInfo>
262 uint32_t size = KeyParamsInfo::getDefaultSize())
263 :
KeyParams(KeyParamsInfo::getType(), keyId)
277 :
KeyParams(KeyParamsInfo::getType(), keyIdType)
290 setKeySize(uint32_t size)
292 m_size = KeyParamsInfo::checkKeySize(size);
296 getDefaultKeySize()
const
298 return KeyParamsInfo::getDefaultSize();
Base class for key parameters.
KeyParams(KeyType keyType, KeyIdType keyIdType)
Constructor.
KeyIdType getKeyIdType() const
KeyType getKeyType() const
const name::Component & getKeyId() const
void setKeyId(const name::Component &keyId)
SimplePublicKeyParams is a template for public keys with only one parameter: size.
SimplePublicKeyParams(const name::Component &keyId, uint32_t size=KeyParamsInfo::getDefaultSize())
Create key parameters with user-specified key id.
SimplePublicKeyParams(uint32_t size=KeyParamsInfo::getDefaultSize(), KeyIdType keyIdType=KeyIdType::RANDOM)
Create key parameters with auto-generated key id.
uint32_t getKeySize() const
SimpleSymmetricKeyParams is a template for symmetric keys with only one parameter: size.
SimpleSymmetricKeyParams(const name::Component &keyId, uint32_t size=KeyParamsInfo::getDefaultSize())
Create key parameters with user-specified key id.
SimpleSymmetricKeyParams(uint32_t size=KeyParamsInfo::getDefaultSize(), KeyIdType keyIdType=KeyIdType::RANDOM)
Create key parameters with auto-generated key id.
uint32_t getKeySize() const
AesKeyParamsInfo is used to instantiate SimpleSymmetricKeyParams for AES keys.
static uint32_t checkKeySize(uint32_t size)
Check if size is valid and supported for this key type.
static constexpr KeyType getType()
static uint32_t getDefaultSize()
EcKeyParamInfo is used to instantiate SimplePublicKeyParams for elliptic curve keys.
static uint32_t checkKeySize(uint32_t size)
Check if size is valid and supported for this key type.
static uint32_t getDefaultSize()
static constexpr KeyType getType()
HmacKeyParamsInfo is used to instantiate SimpleSymmetricKeyParams for HMAC keys.
static uint32_t getDefaultSize()
static constexpr KeyType getType()
static uint32_t checkKeySize(uint32_t size)
Check if size is valid and supported for this key type.
RsaKeyParamInfo is used to instantiate SimplePublicKeyParams for RSA keys.
static uint32_t getDefaultSize()
static uint32_t checkKeySize(uint32_t size)
Check if size is valid and supported for this key type.
static constexpr KeyType getType()
Represents a name component.
SimpleSymmetricKeyParams< detail::HmacKeyParamsInfo > HmacKeyParams
HmacKeyParams carries parameters for HMAC key.
KeyType
The type of a cryptographic key.
@ EC
Elliptic Curve key (e.g. for ECDSA), supports sign/verify operations.
@ RSA
RSA key, supports sign/verify and encrypt/decrypt operations.
@ AES
AES key, supports encrypt/decrypt operations.
@ HMAC
HMAC key, supports sign/verify operations.
KeyIdType
The type of KeyId component in a key name.
@ RANDOM
Use a 64-bit random number as key id.
SimpleSymmetricKeyParams< detail::AesKeyParamsInfo > AesKeyParams
AesKeyParams carries parameters for AES key.
SimplePublicKeyParams< detail::RsaKeyParamsInfo > RsaKeyParams
RsaKeyParams carries parameters for RSA key.
SimplePublicKeyParams< detail::EcKeyParamsInfo > EcKeyParams
EcKeyParams carries parameters for EC key.