aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cert
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-08-08 17:20:35 +0200
committerSimon Warta <[email protected]>2015-08-11 10:50:14 +0200
commit3a85d9aa4da36e7ca46e370f4fe65dddc43f4172 (patch)
tree875edf108dc38536daa6dca1098493608ef78084 /src/lib/cert
parent6dfe8a6e37aa19c59829d98ef47f4d497491be80 (diff)
Remove string constructor of X509_Time()
* Break down string representations to to_string() and readable_string() * Add m_ prefix to member variable names * Fix order of methods * Move comments Doxygen friendly to header * Make set_to() private (future subjejt of refectoring); People should use constructor Closes #185
Diffstat (limited to 'src/lib/cert')
-rw-r--r--src/lib/cert/x509/x509_crl.cpp8
-rw-r--r--src/lib/cert/x509/x509cert.cpp4
-rw-r--r--src/lib/cert/x509/x509opt.cpp4
-rw-r--r--src/lib/cert/x509/x509path.cpp4
4 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/cert/x509/x509_crl.cpp b/src/lib/cert/x509/x509_crl.cpp
index e3dfb787e..5dce682c2 100644
--- a/src/lib/cert/x509/x509_crl.cpp
+++ b/src/lib/cert/x509/x509_crl.cpp
@@ -102,8 +102,8 @@ void X509_CRL::force_decode()
X509_Time start, end;
tbs_crl.decode(start).decode(end);
- info.add("X509.CRL.start", start.readable_string());
- info.add("X509.CRL.end", end.readable_string());
+ info.add("X509.CRL.start", start.to_string());
+ info.add("X509.CRL.end", end.to_string());
BER_Object next = tbs_crl.get_next_object();
@@ -177,7 +177,7 @@ u32bit X509_CRL::crl_number() const
*/
X509_Time X509_CRL::this_update() const
{
- return info.get1("X509.CRL.start");
+ return X509_Time(info.get1("X509.CRL.start"), ASN1_Tag::UTC_TIME);
}
/*
@@ -185,7 +185,7 @@ X509_Time X509_CRL::this_update() const
*/
X509_Time X509_CRL::next_update() const
{
- return info.get1("X509.CRL.end");
+ return X509_Time(info.get1("X509.CRL.end"), ASN1_Tag::UTC_TIME);
}
}
diff --git a/src/lib/cert/x509/x509cert.cpp b/src/lib/cert/x509/x509cert.cpp
index 195af7730..f6f87bbf4 100644
--- a/src/lib/cert/x509/x509cert.cpp
+++ b/src/lib/cert/x509/x509cert.cpp
@@ -136,8 +136,8 @@ void X509_Certificate::force_decode()
subject.add("X509.Certificate.version", version);
subject.add("X509.Certificate.serial", BigInt::encode(serial_bn));
- subject.add("X509.Certificate.start", start.readable_string());
- subject.add("X509.Certificate.end", end.readable_string());
+ subject.add("X509.Certificate.start", start.to_string());
+ subject.add("X509.Certificate.end", end.to_string());
issuer.add("X509.Certificate.v2.key_id", v2_issuer_key_id);
subject.add("X509.Certificate.v2.key_id", v2_subject_key_id);
diff --git a/src/lib/cert/x509/x509opt.cpp b/src/lib/cert/x509/x509opt.cpp
index c620ab25b..ef83124e6 100644
--- a/src/lib/cert/x509/x509opt.cpp
+++ b/src/lib/cert/x509/x509opt.cpp
@@ -17,7 +17,7 @@ namespace Botan {
*/
void X509_Cert_Options::not_before(const std::string& time_string)
{
- start = X509_Time(time_string);
+ start = X509_Time(time_string, ASN1_Tag::UTC_TIME);
}
/*
@@ -25,7 +25,7 @@ void X509_Cert_Options::not_before(const std::string& time_string)
*/
void X509_Cert_Options::not_after(const std::string& time_string)
{
- end = X509_Time(time_string);
+ end = X509_Time(time_string, ASN1_Tag::UTC_TIME);
}
/*
diff --git a/src/lib/cert/x509/x509path.cpp b/src/lib/cert/x509/x509path.cpp
index fa6d34a2d..b6c0df126 100644
--- a/src/lib/cert/x509/x509path.cpp
+++ b/src/lib/cert/x509/x509path.cpp
@@ -107,10 +107,10 @@ check_chain(const std::vector<X509_Certificate>& cert_path,
}
// Check all certs for valid time range
- if(current_time < X509_Time(subject.start_time()))
+ if(current_time < X509_Time(subject.start_time(), ASN1_Tag::UTC_TIME))
status.insert(Certificate_Status_Code::CERT_NOT_YET_VALID);
- if(current_time > X509_Time(subject.end_time()))
+ if(current_time > X509_Time(subject.end_time(), ASN1_Tag::UTC_TIME))
status.insert(Certificate_Status_Code::CERT_HAS_EXPIRED);
// Check issuer constraints