06-test_algorithmid.t 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #! /usr/bin/env perl
  2. # Copyright 2018-2023 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),
  38. disabled('ecx') ? () : qw(tested25519pub tested448pub)
  39. );
  40. my @certs = sort keys %certs_info;
  41. plan tests =>
  42. scalar @certs
  43. + scalar @pubkeys;
  44. foreach (@certs) {
  45. ok(run(test(['algorithmid_test', '-x509',
  46. srctop_file('test', 'certs', "$_.pem"),
  47. srctop_file('test', 'certs', "$certs_info{$_}.pem")])));
  48. }
  49. foreach (sort @pubkeys) {
  50. ok(run(test(['algorithmid_test', '-spki', srctop_file('test', "$_.pem")])));
  51. }