summaryrefslogtreecommitdiff
path: root/test/recipes/25-test_x509.t
diff options
context:
space:
mode:
authorDirk-Willem van Gulik <dirkx@webweaving.org>2020-04-21 23:06:38 +0200
committerDmitry Belyavskiy <beldmit@gmail.com>2020-04-25 18:52:30 +0300
commit47f387e98ebc9867ee7902a43d7bb35462175ce6 (patch)
tree2f15725a735fdfec62b5cd784e579b9f043c8417 /test/recipes/25-test_x509.t
parenta3ab4d63e0da2614b80bce3173001034a4c54e12 (diff)
downloadopenssl-new-47f387e98ebc9867ee7902a43d7bb35462175ce6.tar.gz
Add support for unusal 'othername' subjectAltNames
Increasingly certificates seem to have special things in the subjectAltName that have arbitrary strings in them. E.g. some (now) common in EU export certificates and, for a few years now, certificates issued to medical doctors (in for example the netherlands, the full spec is https://www.uziregister.nl/Media/Default/PDF/20200325%20CA%20model%20pasmodel%20certificaatprofielen%20v10_0.pdf, section 4.8, page 16 for an example of one country). Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/11599)
Diffstat (limited to 'test/recipes/25-test_x509.t')
-rw-r--r--test/recipes/25-test_x509.t18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/recipes/25-test_x509.t b/test/recipes/25-test_x509.t
index 145844013c..427c6b7fea 100644
--- a/test/recipes/25-test_x509.t
+++ b/test/recipes/25-test_x509.t
@@ -16,7 +16,7 @@ use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_x509");
-plan tests => 10;
+plan tests => 11;
require_ok(srctop_file('test','recipes','tconversion.pl'));
@@ -68,4 +68,20 @@ subtest 'x509 -- second x.509 v3 certificate' => sub {
subtest 'x509 -- pathlen' => sub {
ok(run(test(["v3ext", srctop_file("test/certs", "pathlen.pem")])));
+};
+
+subtest 'x500 -- subjectAltName' => sub {
+ my $fp = srctop_file("test/certs", "fake-gp.pem");
+ my $out = "ext.out";
+ ok(run(app(["openssl", "x509", "-text", "-in", $fp, "-out", $out])));
+ ok(has_doctor_id($out));
+ unlink $out;
+};
+
+sub has_doctor_id {
+ $_ = shift @_;
+ open(DATA,$_) or return 0;
+ $_= join('',<DATA>);
+ close(DATA);
+ return m/2.16.528.1.1003.1.3.5.5.2-1-0000006666-Z-12345678-01.015-12345678/;
}