22 #ifndef NDN_SECURITY_KEY_PARAMS_HPP 23 #define NDN_SECURITY_KEY_PARAMS_HPP 26 #include "../name-component.hpp" 38 class Error :
public std::runtime_error
43 :
std::runtime_error(what)
152 template<
typename KeyParamsInfo>
159 uint32_t size = KeyParamsInfo::getDefaultSize())
160 :
KeyParams(KeyParamsInfo::getType(), keyId)
174 :
KeyParams(KeyParamsInfo::getType(), keyIdType)
187 setKeySize(uint32_t size)
189 m_size = KeyParamsInfo::checkKeySize(size);
193 getDefaultKeySize()
const 195 return KeyParamsInfo::getDefaultSize();
237 template<
typename KeyParamsInfo>
244 uint32_t size = KeyParamsInfo::getDefaultSize())
245 :
KeyParams(KeyParamsInfo::getType(), keyId)
259 :
KeyParams(KeyParamsInfo::getType(), keyIdType)
272 setKeySize(uint32_t size)
274 m_size = KeyParamsInfo::checkKeySize(size);
278 getDefaultKeySize()
const 280 return KeyParamsInfo::getDefaultSize();
292 #endif // NDN_SECURITY_KEY_PARAMS_HPP static constexpr KeyType getType()
static constexpr KeyType getType()
Copyright (c) 2011-2015 Regents of the University of California.
static constexpr KeyType getType()
SimpleSymmetricKeyParams is a template for symmetric keys with only one parameter: size...
SimpleSymmetricKeyParams(uint32_t size=KeyParamsInfo::getDefaultSize(), KeyIdType keyIdType=KeyIdType::RANDOM)
Create key parameter with auto-created keyId.
SimpleSymmetricKeyParams(const name::Component &keyId, uint32_t size=KeyParamsInfo::getDefaultSize())
Create key parameter with user specified keyId.
Error(const std::string &what)
KeyIdType
The type of KeyId component in a key name.
void setKeyId(const name::Component &keyId)
static uint32_t checkKeySize(uint32_t size)
check if size is valid and supported for this key type.
RSA key, supports sign/verify and encrypt/decrypt operations.
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.
SimplePublicKeyParams< detail::RsaKeyParamsInfo > RsaKeyParams
RsaKeyParams carries parameters for RSA key.
KeyType
The type of a cryptographic key.
SimplePublicKeyParams< detail::EcKeyParamsInfo > EcKeyParams
EcKeyParams carries parameters for EC key.
SimplePublicKeyParams(const name::Component &keyId, uint32_t size=KeyParamsInfo::getDefaultSize())
Create key parameter with user specified keyId.
Elliptic Curve key (e.g. for ECDSA), supports sign/verify operations.
uint32_t getKeySize() const
KeyType getKeyType() const
SimpleSymmetricKeyParams< detail::AesKeyParamsInfo > AesKeyParams
AesKeyParams carries parameters for AES key.
KeyParams(KeyType keyType, KeyIdType keyIdType)
Create a key generation parameter.
EcKeyParamInfo is used to instantiate SimplePublicKeyParams for elliptic curve keys.
SimplePublicKeyParams(uint32_t size=KeyParamsInfo::getDefaultSize(), KeyIdType keyIdType=KeyIdType::RANDOM)
Create key parameter with auto-created keyId.
Represents a name component.
static uint32_t checkKeySize(uint32_t size)
check if size is valid and supported for this key type.
Use a 64-bit random number as the key id.
Base class of key parameters.
uint32_t getKeySize() const
static uint32_t getDefaultSize()
static uint32_t getDefaultSize()
SimplePublicKeyParams is a template for public keys with only one parameter: size.
AES key, supports encrypt/decrypt operations.
KeyIdType getKeyIdType() const
AesKeyParamsInfo is used to instantiate SimpleSymmetricKeyParams for AES keys.
static uint32_t getDefaultSize()
const name::Component & getKeyId() const