security: IdentityCertificate sets default FreshnessPeriod to 1 hour
refs #2872
Change-Id: Ib2af1a1c8a5bf99310132f55c0f8b5d80d7a2015
diff --git a/src/security/identity-certificate.cpp b/src/security/identity-certificate.cpp
index 7ec06f9..a80684e 100644
--- a/src/security/identity-certificate.cpp
+++ b/src/security/identity-certificate.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -17,8 +17,6 @@
* <http://www.gnu.org/licenses/>.
*
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
*/
#include "common.hpp"
@@ -37,6 +35,7 @@
IdentityCertificate::IdentityCertificate()
{
+ this->setFreshnessPeriod(time::hours(1));
}
IdentityCertificate::IdentityCertificate(const Data& data)
diff --git a/tests/unit-tests/security/key-chain.t.cpp b/tests/unit-tests/security/key-chain.t.cpp
index f3d125a..d364dcf 100644
--- a/tests/unit-tests/security/key-chain.t.cpp
+++ b/tests/unit-tests/security/key-chain.t.cpp
@@ -29,8 +29,6 @@
namespace ndn {
namespace tests {
-using std::vector;
-
BOOST_FIXTURE_TEST_SUITE(SecurityKeyChain, util::TestHomeEnvironmentFixture)
BOOST_AUTO_TEST_CASE(ConstructorNormalConfig)
@@ -194,7 +192,7 @@
identity.appendVersion();
keyChain.createIdentity(identity);
- vector<CertificateSubjectDescription> subjectDescription;
+ std::vector<CertificateSubjectDescription> subjectDescription;
Name lowerIdentity = identity;
lowerIdentity.append("Lower").appendVersion();
Name lowerKeyName = keyChain.generateRsaKeyPair(lowerIdentity, true);
@@ -206,6 +204,7 @@
BOOST_CHECK(static_cast<bool>(idCert));
BOOST_CHECK_EQUAL(idCert->getName().getPrefix(5),
Name().append(identity).append("KEY").append("Lower"));
+ BOOST_CHECK(idCert->getFreshnessPeriod() >= time::milliseconds::zero());
shared_ptr<IdentityCertificate> idCert11 =
keyChain.prepareUnsignedIdentityCertificate(lowerKeyName, identity,