aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/unit_x509.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/unit_x509.cpp')
-rw-r--r--src/tests/unit_x509.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp
index aab0b83d5..da60348c8 100644
--- a/src/tests/unit_x509.cpp
+++ b/src/tests/unit_x509.cpp
@@ -11,6 +11,7 @@
#include <botan/calendar.h>
#include <botan/pkcs10.h>
+ #include <botan/pkcs8.h>
#include <botan/x509self.h>
#include <botan/x509path.h>
#include <botan/x509_ca.h>
@@ -358,6 +359,30 @@ Test::Result test_x509_dates()
return result;
}
+Test::Result test_crl_dn_name()
+ {
+ Test::Result result("CRL DN name");
+
+ // See GH #1252
+
+ const Botan::OID dc_oid("0.9.2342.19200300.100.1.25");
+
+ Botan::X509_Certificate cert(Test::data_file("misc_certs/opcuactt_ca.der"));
+
+ Botan::DataSource_Stream key_input(Test::data_file("misc_certs/opcuactt_ca.pem"));
+ std::unique_ptr<Botan::Private_Key> key = Botan::PKCS8::load_key(key_input);
+ Botan::X509_CA ca(cert, *key, "SHA-256", Test::rng());
+
+ Botan::X509_CRL crl = ca.new_crl(Test::rng());
+
+ result.confirm("matches issuer cert", crl.issuer_dn() == cert.subject_dn());
+
+ result.confirm("contains DC component",
+ crl.issuer_dn().get_attributes().count(dc_oid) == 1);
+
+ return result;
+ }
+
Test::Result test_x509_utf8()
{
Test::Result result("X509 with UTF-8 encoded fields");
@@ -1219,6 +1244,7 @@ class X509_Cert_Unit_Tests final : public Test
results.push_back(test_hashes("ECDSA"));
results.push_back(test_x509_utf8());
results.push_back(test_x509_bmpstring());
+ results.push_back(test_crl_dn_name());
return results;
}