aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/x509/x509cert.cpp
diff options
context:
space:
mode:
authorNuno Goncalves <[email protected]>2017-02-27 16:12:30 +0100
committerNuno Goncalves <[email protected]>2017-04-03 22:39:11 +0200
commitf7cf31ef5f8d9bc9c846415966566e307ec9510b (patch)
treecec463d5c9a443c300491bee75d70f901bbcf9b0 /src/lib/x509/x509cert.cpp
parentc760bbd4873ba48ce743ff036e5c2c9572fb3b4b (diff)
Add X509 issuer and subject DN hash methods
Signed-off-by: Nuno Goncalves <[email protected]>
Diffstat (limited to 'src/lib/x509/x509cert.cpp')
-rw-r--r--src/lib/x509/x509cert.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/x509/x509cert.cpp b/src/lib/x509/x509cert.cpp
index b6e15a3e0..512e4aa63 100644
--- a/src/lib/x509/x509cert.cpp
+++ b/src/lib/x509/x509cert.cpp
@@ -439,6 +439,13 @@ std::vector<uint8_t> X509_Certificate::raw_issuer_dn() const
return m_issuer.get1_memvec("X509.Certificate.dn_bits");
}
+std::vector<uint8_t> X509_Certificate::raw_issuer_dn_sha256() const
+ {
+ std::unique_ptr<HashFunction> hash(HashFunction::create("SHA-256"));
+ hash->update(raw_issuer_dn());
+ return hash->final_stdvec();
+ }
+
X509_DN X509_Certificate::subject_dn() const
{
return create_dn(m_subject);
@@ -449,6 +456,13 @@ std::vector<uint8_t> X509_Certificate::raw_subject_dn() const
return m_subject.get1_memvec("X509.Certificate.dn_bits");
}
+std::vector<uint8_t> X509_Certificate::raw_subject_dn_sha256() const
+ {
+ std::unique_ptr<HashFunction> hash(HashFunction::create("SHA-256"));
+ hash->update(raw_subject_dn());
+ return hash->final_stdvec();
+ }
+
std::string X509_Certificate::fingerprint(const std::string& hash_name) const
{
std::unique_ptr<HashFunction> hash(HashFunction::create(hash_name));