25-test_x509.t 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #! /usr/bin/env perl
  2. # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the OpenSSL license (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. use strict;
  9. use warnings;
  10. use File::Spec;
  11. use OpenSSL::Test qw/:DEFAULT srctop_file/;
  12. setup("test_x509");
  13. plan tests => 9;
  14. require_ok(srctop_file('test','recipes','tconversion.pl'));
  15. my $pem = srctop_file("test/certs", "cyrillic.pem");
  16. my $out = "cyrillic.out";
  17. my $msb = srctop_file("test/certs", "cyrillic.msb");
  18. my $utf = srctop_file("test/certs", "cyrillic.utf8");
  19. ok(run(app(["openssl", "x509", "-text", "-in", $pem, "-out", $out,
  20. "-nameopt", "esc_msb"])));
  21. is(cmp_text($out, srctop_file("test/certs", "cyrillic.msb")),
  22. 0, 'Comparing esc_msb output');
  23. ok(run(app(["openssl", "x509", "-text", "-in", $pem, "-out", $out,
  24. "-nameopt", "utf8"])));
  25. is(cmp_text($out, srctop_file("test/certs", "cyrillic.utf8")),
  26. 0, 'Comparing utf8 output');
  27. unlink $out;
  28. subtest 'x509 -- x.509 v1 certificate' => sub {
  29. tconversion("x509", srctop_file("test","testx509.pem"));
  30. };
  31. subtest 'x509 -- first x.509 v3 certificate' => sub {
  32. tconversion("x509", srctop_file("test","v3-cert1.pem"));
  33. };
  34. subtest 'x509 -- second x.509 v3 certificate' => sub {
  35. tconversion("x509", srctop_file("test","v3-cert2.pem"));
  36. };
  37. subtest 'x509 -- pathlen' => sub {
  38. ok(run(test(["v3ext", srctop_file("test/certs", "pathlen.pem")])));
  39. }