security: support 224-bit and 521-bit NIST elliptic curves

Change-Id: I28d2e5162e1e8fd7261828d435b059093b6989ea
diff --git a/src/security/transform/private-key.cpp b/src/security/transform/private-key.cpp
index 84a1875..4c6a763 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-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -401,14 +401,20 @@
 
   int ret;
   switch (keySize) {
-    case 256:
-      ret = EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, NID_X9_62_prime256v1); // same as secp256r1
-      break;
-    case 384:
-      ret = EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, NID_secp384r1);
-      break;
-    default:
-      BOOST_THROW_EXCEPTION(PrivateKey::Error("Unsupported EC key length"));
+  case 224:
+    ret = EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, NID_secp224r1);
+    break;
+  case 256:
+    ret = EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, NID_X9_62_prime256v1); // same as secp256r1
+    break;
+  case 384:
+    ret = EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, NID_secp384r1);
+    break;
+  case 521:
+    ret = EVP_PKEY_CTX_set_ec_paramgen_curve_nid(pctx, NID_secp521r1);
+    break;
+  default:
+    BOOST_THROW_EXCEPTION(std::invalid_argument("Unsupported EC key length " + to_string(keySize)));
   }
   if (ret <= 0)
     BOOST_THROW_EXCEPTION(PrivateKey::Error("Failed to set EC curve"));
diff --git a/src/security/transform/private-key.hpp b/src/security/transform/private-key.hpp
index fb4978a..e1af107 100644
--- a/src/security/transform/private-key.hpp
+++ b/src/security/transform/private-key.hpp
@@ -257,10 +257,10 @@
 /**
  * @brief Generate a private key according to @p keyParams
  *
- * @note The public key can be derived from the private key.
+ * @note The corresponding public key can be derived from the private key.
  *
  * @throw std::invalid_argument the specified key type is not supported
- * @throw std::runtime_error    key generation fails
+ * @throw PrivateKey::Error     key generation failed
  */
 unique_ptr<PrivateKey>
 generatePrivateKey(const KeyParams& keyParams);