Add functionality of endorsement
diff --git a/src/endorse-certificate.cpp b/src/endorse-certificate.cpp
index 8dd43e0..20e2aff 100644
--- a/src/endorse-certificate.cpp
+++ b/src/endorse-certificate.cpp
@@ -97,9 +97,36 @@
return blobStream.buf ();
}
+// EndorseCertificate::EndorseCertificate(const IdentityCertificate& kskCertificate)
+// : Certificate()
+// , m_keyName(kskCertificate.getPublicKeyName())
+// , m_signer(kskCertificate.getPublicKeyName())
+// {
+// Profile profile(m_keyName.getPrefix(m_keyName.size()-1),
+// m_keyName.get(-2).toUri(),
+// m_keyName.get(m_keyName.size()-2).toUri());
+
+// Ptr<ProfileData> profileData = Ptr<ProfileData>(new ProfileData(m_keyName.getPrefix(m_keyName.size()-1),
+// profile));
+
+// m_profileData = profileData;
+
+// Name dataName = m_keyName;
+// dataName.append("PROFILE-CERT").append(m_signer).appendVersion();
+// setName(dataName);
+
+// setNotBefore(kskCertificate.getNotBefore());
+// setNotAfter(kskCertificate.getNotAfter());
+// addSubjectDescription(CertificateSubDescrypt("2.5.4.41", m_keyName.toUri()));
+// setPublicKeyInfo(kskCertificate.getPublicKeyInfo());
+// addExtension(ProfileExtension(*m_profileData));
+// addExtension(EndorseExtension(m_endorseList));
+
+// encode();
+// }
+
+
EndorseCertificate::EndorseCertificate(const IdentityCertificate& kskCertificate,
- const Time& notBefore,
- const Time& notAfter,
Ptr<ProfileData> profileData,
const vector<string>& endorseList)
: Certificate()
@@ -109,14 +136,11 @@
, m_endorseList(endorseList)
{
Name dataName = m_keyName;
- TimeInterval ti = time::NowUnixTimestamp();
- ostringstream oss;
- oss << ti.total_seconds();
- dataName.append("PROFILE-CERT").append(m_signer).append(oss.str());
+ dataName.append("PROFILE-CERT").append(m_signer).appendVersion();
setName(dataName);
- setNotBefore(notBefore);
- setNotAfter(notAfter);
+ setNotBefore(kskCertificate.getNotBefore());
+ setNotAfter(kskCertificate.getNotAfter());
addSubjectDescription(CertificateSubDescrypt("2.5.4.41", m_keyName.toUri()));
setPublicKeyInfo(kskCertificate.getPublicKeyInfo());
addExtension(ProfileExtension(*m_profileData));
@@ -127,8 +151,6 @@
EndorseCertificate::EndorseCertificate(const EndorseCertificate& endorseCertificate,
const Name& signer,
- const Time& notBefore,
- const Time& notAfter,
const vector<string>& endorseList)
: Certificate()
, m_keyName(endorseCertificate.m_keyName)
@@ -137,14 +159,11 @@
, m_endorseList(endorseList)
{
Name dataName = m_keyName;
- TimeInterval ti = time::NowUnixTimestamp();
- ostringstream oss;
- oss << ti.total_seconds();
- dataName.append("PROFILE-CERT").append(m_signer).append(oss.str());
+ dataName.append("PROFILE-CERT").append(m_signer).appendVersion();
setName(dataName);
- setNotBefore(notBefore);
- setNotAfter(notAfter);
+ setNotBefore(endorseCertificate.getNotBefore());
+ setNotAfter(endorseCertificate.getNotAfter());
addSubjectDescription(CertificateSubDescrypt("2.5.4.41", m_keyName.toUri()));
setPublicKeyInfo(endorseCertificate.getPublicKeyInfo());
addExtension(ProfileExtension(*m_profileData));