Skip to content

Commit

Permalink
Merge pull request #71 from Dadoum/master
Browse files Browse the repository at this point in the history
Add m_throw_on_unknown_critical to X509_cert
  • Loading branch information
etcimon authored Nov 2, 2023
2 parents 9ef9922 + a0c2066 commit 5257ff4
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions source/botan/cert/x509/x509cert.d
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,9 @@ public:
* Params:
* input = the data source
*/
this(DataSource input)
this(DataSource input, bool throw_on_unknown_critical_ = true)
{
m_throw_on_unknown_critical = throw_on_unknown_critical_;
super(input, "CERTIFICATE/X509 CERTIFICATE");
m_self_signed = false;
doDecode();
Expand All @@ -512,22 +513,25 @@ public:
* Params:
* filename = the name of the certificate file
*/
this(in string filename)
this(in string filename, bool throw_on_unknown_critical_ = true)
{
m_throw_on_unknown_critical = throw_on_unknown_critical_;
super(filename, "CERTIFICATE/X509 CERTIFICATE");
m_self_signed = false;
doDecode();
}

this(ALLOC)(auto const ref Vector!(ubyte, ALLOC) input)
this(ALLOC)(auto const ref Vector!(ubyte, ALLOC) input, bool throw_on_unknown_critical_ = true)
{
m_throw_on_unknown_critical = throw_on_unknown_critical_;
super(input, "CERTIFICATE/X509 CERTIFICATE");
m_self_signed = false;
doDecode();
}

this(ALLOC)(auto const ref RefCounted!(Vector!(ubyte, ALLOC), ALLOC) input)
this(ALLOC)(auto const ref RefCounted!(Vector!(ubyte, ALLOC), ALLOC) input, bool throw_on_unknown_critical_ = true)
{
m_throw_on_unknown_critical = throw_on_unknown_critical_;
super(input, "CERTIFICATE/X509 CERTIFICATE");
m_self_signed = false;
doDecode();
Expand Down Expand Up @@ -588,7 +592,7 @@ protected:
if (v3_exts_data.type_tag == 3 &&
v3_exts_data.class_tag == (ASN1Tag.CONSTRUCTED | ASN1Tag.CONTEXT_SPECIFIC))
{
X509Extensions extensions = X509Extensions(true);
X509Extensions extensions = X509Extensions(m_throw_on_unknown_critical);

BERDecoder(v3_exts_data.value).decode(extensions).verifyEnd();

Expand Down Expand Up @@ -632,6 +636,7 @@ protected:

DataStore m_subject, m_issuer;
bool m_self_signed;
bool m_throw_on_unknown_critical;
}


Expand Down

0 comments on commit 5257ff4

Please sign in to comment.