1#! /usr/bin/env perl
2
3# Copyright 2018-2023 The OpenSSL Project Authors. All Rights Reserved.
4#
5# Licensed under the Apache License 2.0 (the "License").  You may not use
6# this file except in compliance with the License.  You can obtain a copy
7# in the file LICENSE in the source distribution or at
8# https://www.openssl.org/source/license.html
9
10use strict;
11
12use OpenSSL::Test qw(:DEFAULT srctop_file);
13use OpenSSL::Test::Utils;
14
15setup("test_algorithmid");
16
17# eecert => cacert
18my %certs_info =
19    (
20     'ee-cert' => 'ca-cert',
21     'ee-cert2' => 'ca-cert2',
22
23     # 'ee-pss-sha1-cert' => 'ca-cert',
24     # 'ee-pss-sha256-cert' => 'ca-cert',
25     # 'ee-pss-cert' => 'ca-pss-cert',
26     # 'server-pss-restrict-cert' => 'rootcert',
27
28     (
29      disabled('ec')
30      ? ()
31      : (
32         'ee-cert-ec-explicit' => 'ca-cert-ec-named',
33         'ee-cert-ec-named-explicit' => 'ca-cert-ec-explicit',
34         'ee-cert-ec-named-named' => 'ca-cert-ec-named',
35         # 'server-ed448-cert' => 'root-ed448-cert'
36         'server-ecdsa-brainpoolP256r1-cert' => 'rootcert',
37        )
38     )
39    );
40my @pubkeys =
41    (
42     'testrsapub',
43     disabled('dsa') ? () : 'testdsapub',
44     disabled('ec') ? () : qw(testecpub-p256),
45     disabled('ecx') ? () : qw(tested25519pub tested448pub)
46    );
47my @certs = sort keys %certs_info;
48
49plan tests =>
50    scalar @certs
51    + scalar @pubkeys;
52
53foreach (@certs) {
54    ok(run(test(['algorithmid_test', '-x509',
55                 srctop_file('test', 'certs', "$_.pem"),
56                 srctop_file('test', 'certs', "$certs_info{$_}.pem")])));
57}
58
59foreach (sort @pubkeys) {
60    ok(run(test(['algorithmid_test', '-spki', srctop_file('test', "$_.pem")])));
61}
62