aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/x509/x509_ext.h
diff options
context:
space:
mode:
authorRenĂ© Korthaus <[email protected]>2016-09-05 11:01:42 +0200
committerRenĂ© Korthaus <[email protected]>2016-12-02 11:01:59 +0100
commite8b3e26f4167524216718204c6b5a14ed0e7942d (patch)
tree12e4469750d81a565185212766c0d51a7312ea4d /src/lib/x509/x509_ext.h
parent5c49dbac212e53be821b0771d3df46f78801efbe (diff)
Allow custom extensions in X509_Cert_Options
Allow custom extensions in CA-signed cert requests Add templated getter for extensions
Diffstat (limited to 'src/lib/x509/x509_ext.h')
-rw-r--r--src/lib/x509/x509_ext.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/x509/x509_ext.h b/src/lib/x509/x509_ext.h
index b1984fa94..ee7589ea5 100644
--- a/src/lib/x509/x509_ext.h
+++ b/src/lib/x509/x509_ext.h
@@ -92,6 +92,29 @@ class BOTAN_DLL Extensions : public ASN1_Object
void contents_to(Data_Store&, Data_Store&) const;
void add(Certificate_Extension* extn, bool critical = false);
+ void replace(Certificate_Extension* extn, bool critical = false);
+
+ Certificate_Extension* get(const OID& oid) const;
+
+ template<typename T>
+ std::unique_ptr<T> get_extension(const OID& oid)
+ {
+ try
+ {
+ if(m_extensions_raw.count(oid) > 0)
+ {
+ std::unique_ptr<T> ext(new T);
+ ext->decode_inner(m_extensions_raw[oid].first);
+ return std::move(ext);
+ }
+ }
+ catch(std::exception& e)
+ {
+ throw Decoding_Error("Exception while decoding extension " +
+ oid.as_string() + ": " + e.what());
+ }
+ return nullptr;
+ }
std::vector<std::pair<std::unique_ptr<Certificate_Extension>, bool>> extensions() const;