06-test_algorithmid.t 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #! /usr/bin/env perl
  2. # Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (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 OpenSSL::Test qw(:DEFAULT srctop_file);
  10. use OpenSSL::Test::Utils;
  11. setup("test_algorithmid");
  12. # eecert => cacert
  13. my %certs_info =
  14. (
  15. 'ee-cert' => 'ca-cert',
  16. 'ee-cert2' => 'ca-cert2',
  17. # 'ee-pss-sha1-cert' => 'ca-cert',
  18. # 'ee-pss-sha256-cert' => 'ca-cert',
  19. # 'ee-pss-cert' => 'ca-pss-cert',
  20. # 'server-pss-restrict-cert' => 'rootcert',
  21. (
  22. disabled('ec')
  23. ? ()
  24. : (
  25. 'ee-cert-ec-explicit' => 'ca-cert-ec-named',
  26. 'ee-cert-ec-named-explicit' => 'ca-cert-ec-explicit',
  27. 'ee-cert-ec-named-named' => 'ca-cert-ec-named',
  28. # 'server-ed448-cert' => 'root-ed448-cert'
  29. 'server-ecdsa-brainpoolP256r1-cert' => 'rootcert',
  30. )
  31. )
  32. );
  33. my @pubkeys =
  34. (
  35. 'testrsapub',
  36. disabled('dsa') ? () : 'testdsapub',
  37. disabled('ec') ? () : qw(testecpub-p256 tested25519pub tested448pub)
  38. );
  39. my @certs = sort keys %certs_info;
  40. plan tests =>
  41. scalar @certs
  42. + scalar @pubkeys;
  43. foreach (@certs) {
  44. ok(run(test(['algorithmid_test', '-x509',
  45. srctop_file('test', 'certs', "$_.pem"),
  46. srctop_file('test', 'certs', "$certs_info{$_}.pem")])));
  47. }
  48. foreach (sort @pubkeys) {
  49. ok(run(test(['algorithmid_test', '-spki', srctop_file('test', "$_.pem")])));
  50. }