security: Renaming EcdsaKeyParams to EcKeyParams
Change-Id: If27faf095474f5be3f8f454925b389b97bf4425d
Refs: #3135
diff --git a/src/security/key-params.cpp b/src/security/key-params.cpp
index 792efe1..546597c 100644
--- a/src/security/key-params.cpp
+++ b/src/security/key-params.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,7 +25,7 @@
static const uint32_t MIN_RSA_KEY_SIZE = 1024;
static const uint32_t DEFAULT_RSA_KEY_SIZE = 2048;
-static const uint32_t ECDSA_KEY_SIZES[] = {256, 384};
+static const uint32_t EC_KEY_SIZES[] = {256, 384};
static const uint32_t AES_KEY_SIZES[] = {128, 192, 256};
KeyParams::~KeyParams() = default;
@@ -60,19 +60,19 @@
}
uint32_t
-EcdsaKeyParamsInfo::checkKeySize(uint32_t size)
+EcKeyParamsInfo::checkKeySize(uint32_t size)
{
- for (size_t i = 0; i < (sizeof(ECDSA_KEY_SIZES) / sizeof(ECDSA_KEY_SIZES[0])); i++) {
- if (ECDSA_KEY_SIZES[i] == size)
+ for (size_t i = 0; i < (sizeof(EC_KEY_SIZES) / sizeof(EC_KEY_SIZES[0])); i++) {
+ if (EC_KEY_SIZES[i] == size)
return size;
}
BOOST_THROW_EXCEPTION(KeyParams::Error("Unsupported key size"));
}
uint32_t
-EcdsaKeyParamsInfo::getDefaultSize()
+EcKeyParamsInfo::getDefaultSize()
{
- return ECDSA_KEY_SIZES[0];
+ return EC_KEY_SIZES[0];
}
diff --git a/src/security/key-params.hpp b/src/security/key-params.hpp
index 8f28a3e..ee46c71 100644
--- a/src/security/key-params.hpp
+++ b/src/security/key-params.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -122,8 +122,8 @@
getDefaultSize();
};
-/// @brief EcdsaKeyParamInfo is used to initialize a SimplePublicKeyParams template for ECDSA key.
-class EcdsaKeyParamsInfo
+/// @brief EcKeyParamInfo is used to initialize a SimplePublicKeyParams template for elliptic curve key.
+class EcKeyParamsInfo
{
public:
static KeyType
@@ -199,9 +199,8 @@
/// @brief RsaKeyParams carries parameters for RSA key.
typedef SimplePublicKeyParams<RsaKeyParamsInfo> RsaKeyParams;
-/// @brief EcdsaKeyParams carries parameters for ECDSA key.
-typedef SimplePublicKeyParams<EcdsaKeyParamsInfo> EcdsaKeyParams;
-
+/// @brief EcKeyParams carries parameters for EC key.
+typedef SimplePublicKeyParams<EcKeyParamsInfo> EcKeyParams;
/// @brief AesKeyParamsInfo is used to initialize a SimpleSymmetricKeyParams template for AES key.
class AesKeyParamsInfo
@@ -225,7 +224,6 @@
getDefaultSize();
};
-
/// @brief SimpleSymmetricKeyParams is a template for symmetric keys with only one parameter: size.
template<typename KeyParamsInfo>
class SimpleSymmetricKeyParams : public KeyParams
diff --git a/src/security/tpm/back-end-osx.cpp b/src/security/tpm/back-end-osx.cpp
index 178ae55..7f1aed1 100644
--- a/src/security/tpm/back-end-osx.cpp
+++ b/src/security/tpm/back-end-osx.cpp
@@ -341,8 +341,8 @@
break;
}
case KeyType::EC: {
- const EcdsaKeyParams& ecdsaParams = static_cast<const EcdsaKeyParams&>(params);
- keySize = ecdsaParams.getKeySize();
+ const EcKeyParams& ecParams = static_cast<const EcKeyParams&>(params);
+ keySize = ecParams.getKeySize();
break;
}
default: {
diff --git a/src/security/transform/private-key.cpp b/src/security/transform/private-key.cpp
index 8dfef00..368eec1 100644
--- a/src/security/transform/private-key.cpp
+++ b/src/security/transform/private-key.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -431,8 +431,8 @@
return generateRsaKey(rsaParams.getKeySize());
}
case KeyType::EC: {
- const EcdsaKeyParams& ecdsaParams = static_cast<const EcdsaKeyParams&>(keyParams);
- return generateEcKey(ecdsaParams.getKeySize());
+ const EcKeyParams& ecParams = static_cast<const EcKeyParams&>(keyParams);
+ return generateEcKey(ecParams.getKeySize());
}
default:
BOOST_THROW_EXCEPTION(std::invalid_argument("Unsupported asymmetric key type"));
diff --git a/src/security/v1/certificate.cpp b/src/security/v1/certificate.cpp
index 823c994..d686a50 100644
--- a/src/security/v1/certificate.cpp
+++ b/src/security/v1/certificate.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -288,7 +288,7 @@
os << "(RSA)";
break;
case KeyType::EC:
- os << "(ECDSA)";
+ os << "(EC)";
break;
default:
os << "(Unknown key type)";
diff --git a/src/security/v1/key-chain.cpp b/src/security/v1/key-chain.cpp
index f70bf05..57b8649 100644
--- a/src/security/v1/key-chain.cpp
+++ b/src/security/v1/key-chain.cpp
@@ -331,18 +331,16 @@
}
Name
-KeyChain::generateEcdsaKeyPair(const Name& identityName, bool isKsk, uint32_t keySize)
+KeyChain::generateEcKeyPair(const Name& identityName, bool isKsk, uint32_t keySize)
{
- EcdsaKeyParams params(keySize);
+ EcKeyParams params(keySize);
return generateKeyPair(identityName, isKsk, params);
}
Name
KeyChain::generateRsaKeyPairAsDefault(const Name& identityName, bool isKsk, uint32_t keySize)
{
- RsaKeyParams params(keySize);
-
- Name keyName = generateKeyPair(identityName, isKsk, params);
+ Name keyName = generateRsaKeyPair(identityName, isKsk, keySize);
m_pib->setDefaultKeyNameForIdentity(keyName);
@@ -350,11 +348,9 @@
}
Name
-KeyChain::generateEcdsaKeyPairAsDefault(const Name& identityName, bool isKsk, uint32_t keySize)
+KeyChain::generateEcKeyPairAsDefault(const Name& identityName, bool isKsk, uint32_t keySize)
{
- EcdsaKeyParams params(keySize);
-
- Name keyName = generateKeyPair(identityName, isKsk, params);
+ Name keyName = generateEcKeyPair(identityName, isKsk, keySize);
m_pib->setDefaultKeyNameForIdentity(keyName);
@@ -670,8 +666,8 @@
return defaultRsaParams;
}
case KeyType::EC: {
- static EcdsaKeyParams defaultEcdsaParams;
- return defaultEcdsaParams;
+ static EcKeyParams defaultEcParams;
+ return defaultEcParams;
}
case KeyType::NONE: {
return DEFAULT_KEY_PARAMS;
diff --git a/src/security/v1/key-chain.hpp b/src/security/v1/key-chain.hpp
index 73aab90..65821fa 100644
--- a/src/security/v1/key-chain.hpp
+++ b/src/security/v1/key-chain.hpp
@@ -164,13 +164,13 @@
* @param isKsk true for generating a Key-Signing-Key (KSK), false for a Data-Signing-Key (KSK).
* @param keySize The size of the key.
* @return The generated key name.
- * @see generateEcdsaKeyPair
+ * @see generateEcKeyPair
*/
Name
generateRsaKeyPair(const Name& identityName, bool isKsk = false, uint32_t keySize = 2048);
/**
- * @brief Generate a pair of ECDSA keys for the specified identity.
+ * @brief Generate a pair of EC keys for the specified identity.
*
* @param identityName The name of the identity.
* @param isKsk true for generating a Key-Signing-Key (KSK), false for a Data-Signing-Key (KSK).
@@ -179,7 +179,7 @@
* @see generateRsaKeyPair
*/
Name
- generateEcdsaKeyPair(const Name& identityName, bool isKsk = false, uint32_t keySize = 256);
+ generateEcKeyPair(const Name& identityName, bool isKsk = false, uint32_t keySize = 256);
/**
* @brief Generate a pair of RSA keys for the specified identity and set it as default key for
@@ -189,23 +189,23 @@
* @param isKsk true for generating a Key-Signing-Key (KSK), false for a Data-Signing-Key (KSK).
* @param keySize The size of the key.
* @return The generated key name.
- * @see generateRsaKeyPair, generateEcdsaKeyPair, generateEcdsaKeyPairAsDefault
+ * @see generateRsaKeyPair, generateEcKeyPair, generateEcKeyPairAsDefault
*/
Name
generateRsaKeyPairAsDefault(const Name& identityName, bool isKsk = false, uint32_t keySize = 2048);
/**
- * @brief Generate a pair of ECDSA keys for the specified identity and set it as default key for
+ * @brief Generate a pair of EC keys for the specified identity and set it as default key for
* the identity.
*
* @param identityName The name of the identity.
* @param isKsk true for generating a Key-Signing-Key (KSK), false for a Data-Signing-Key (KSK).
* @param keySize The size of the key.
* @return The generated key name.
- * @see generateRsaKeyPair, generateEcdsaKeyPair, generateRsaKeyPairAsDefault
+ * @see generateRsaKeyPair, generateEcKeyPair, generateRsaKeyPairAsDefault
*/
Name
- generateEcdsaKeyPairAsDefault(const Name& identityName, bool isKsk = false, uint32_t keySize = 256);
+ generateEcKeyPairAsDefault(const Name& identityName, bool isKsk = false, uint32_t keySize = 256);
/**
* @brief prepare an unsigned identity certificate
diff --git a/src/security/v1/public-key.cpp b/src/security/v1/public-key.cpp
index 2721dee..cef7295 100644
--- a/src/security/v1/public-key.cpp
+++ b/src/security/v1/public-key.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -112,7 +112,7 @@
else if (algorithm == oid::ECDSA)
m_type = KeyType::EC;
else
- BOOST_THROW_EXCEPTION(Error("Only RSA/ECDSA public keys are supported for now (" +
+ BOOST_THROW_EXCEPTION(Error("Only RSA/EC public keys are supported for now (" +
algorithm.toString() + " requested)"));
}
}
diff --git a/src/security/v1/sec-tpm-file.cpp b/src/security/v1/sec-tpm-file.cpp
index adda17f..a4bb654 100644
--- a/src/security/v1/sec-tpm-file.cpp
+++ b/src/security/v1/sec-tpm-file.cpp
@@ -166,10 +166,10 @@
case KeyType::EC: {
using namespace CryptoPP;
- const EcdsaKeyParams& ecdsaParams = static_cast<const EcdsaKeyParams&>(params);
+ const EcKeyParams& ecParams = static_cast<const EcKeyParams&>(params);
CryptoPP::OID curveName;
- switch (ecdsaParams.getKeySize()) {
+ switch (ecParams.getKeySize()) {
case 256:
curveName = ASN1::secp256r1();
break;
diff --git a/src/security/v1/sec-tpm-osx.cpp b/src/security/v1/sec-tpm-osx.cpp
index f3c3029..f43faa9 100644
--- a/src/security/v1/sec-tpm-osx.cpp
+++ b/src/security/v1/sec-tpm-osx.cpp
@@ -403,8 +403,8 @@
}
case KeyType::EC: {
- const EcdsaKeyParams& ecdsaParams = static_cast<const EcdsaKeyParams&>(params);
- keySize = ecdsaParams.getKeySize();
+ const EcKeyParams& ecParams = static_cast<const EcKeyParams&>(params);
+ keySize = ecParams.getKeySize();
break;
}
diff --git a/src/security/v2/key-chain.cpp b/src/security/v2/key-chain.cpp
index de9281d..850ad58 100644
--- a/src/security/v2/key-chain.cpp
+++ b/src/security/v2/key-chain.cpp
@@ -154,7 +154,7 @@
const KeyParams&
KeyChain::getDefaultKeyParams()
{
- static EcdsaKeyParams keyParams;
+ static EcKeyParams keyParams;
return keyParams;
}
diff --git a/src/security/v2/key-chain.hpp b/src/security/v2/key-chain.hpp
index ca394a5..0e8402e 100644
--- a/src/security/v2/key-chain.hpp
+++ b/src/security/v2/key-chain.hpp
@@ -134,7 +134,7 @@
*
* @param identityName The name of the identity.
* @param params The key parameters if a key needs to be created for the identity (default:
- * ECDSA key with random key id)
+ * EC key with random key id)
* @return The created Identity instance.
*/
Identity
@@ -162,7 +162,7 @@
*
* @param identity reference to a valid Identity object
* @param params The key parameters if a key needs to be created for the identity (default:
- * ECDSA key with random key id)
+ * EC key with random key id)
*
* If @p identity had no default key selected, the created key will be set as the default for
* this identity.