aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov/pkcs11/p11_x509.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-07-04 18:40:16 -0400
committerJack Lloyd <[email protected]>2016-07-04 18:40:16 -0400
commit360a3a50cda6b9eb7e2c001eb2bc397a0ed7b975 (patch)
treec092f21006218145a2849d6a56fa056c601a13f8 /src/lib/prov/pkcs11/p11_x509.cpp
parent696a8319d1f0652a301b6340bf4f0229090139f4 (diff)
parent2ea6f9b1963795dad74489b41bc7d37f897d7a21 (diff)
Merge GH #507 Add PKCS #11 support
Diffstat (limited to 'src/lib/prov/pkcs11/p11_x509.cpp')
-rw-r--r--src/lib/prov/pkcs11/p11_x509.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/prov/pkcs11/p11_x509.cpp b/src/lib/prov/pkcs11/p11_x509.cpp
new file mode 100644
index 000000000..76b120368
--- /dev/null
+++ b/src/lib/prov/pkcs11/p11_x509.cpp
@@ -0,0 +1,37 @@
+/*
+* PKCS#11 X.509
+* (C) 2016 Daniel Neus, Sirrix AG
+* (C) 2016 Philipp Weber, Sirrix AG
+*
+* Botan is released under the Simplified BSD License (see license.txt)
+*/
+
+#include <botan/p11_x509.h>
+
+#if defined(BOTAN_HAS_X509_CERTIFICATES)
+
+namespace Botan {
+namespace PKCS11 {
+
+X509_CertificateProperties::X509_CertificateProperties(const std::vector<byte>& subject, const std::vector<byte>& value)
+ : CertificateProperties(CertificateType::X509), m_subject(subject), m_value(value)
+ {
+ add_binary(AttributeType::Subject, m_subject);
+ add_binary(AttributeType::Value, m_value);
+ }
+
+PKCS11_X509_Certificate::PKCS11_X509_Certificate(Session& session, ObjectHandle handle)
+ : Object(session, handle), X509_Certificate(unlock(get_attribute_value(AttributeType::Value)))
+ {
+ }
+
+PKCS11_X509_Certificate::PKCS11_X509_Certificate(Session& session, const X509_CertificateProperties& props)
+ : Object(session, props), X509_Certificate(props.value())
+ {
+ }
+
+}
+
+}
+
+#endif