security: Fix signing by identity (ECDSA)
When signing by identity, if no certificate is available for the default
key and its type does not corresponds to the `DEFAULT_KEY_PARAMS` a new
pair of `DEFAULT_KEY_PARAMS` keys is created, set as default and used for
signing. Solved by checking the type of key of the default key pair for
the identity.
Change-Id: I75c117cea17cbbfda410da9a83dd16b92d345d21
Refs: #3438
diff --git a/src/security/key-chain.hpp b/src/security/key-chain.hpp
index c5082d3..28c026e 100644
--- a/src/security/key-chain.hpp
+++ b/src/security/key-chain.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -528,6 +528,16 @@
return m_pib->getDefaultKeyNameForIdentity(identityName);
}
+ /**
+ * @brief Get default key parameters for the specified identity
+ *
+ * If identity has a previously generated key, the returned parameters
+ * will include the same type of the key. If there are no existing
+ * keys, DEFAULT_KEY_PARAMS is used.
+ */
+ const KeyParams&
+ getDefaultKeyParamsForIdentity(const Name& identityName) const;
+
Name
getDefaultCertificateNameForKey(const Name& keyName) const
{