]> git.ipfire.org Git - thirdparty/openssl.git/blob - test/recipes/60-test_x509_check_cert_pkey.t
Add ECDSA to providers
[thirdparty/openssl.git] / test / recipes / 60-test_x509_check_cert_pkey.t
1 #! /usr/bin/env perl
2 # Copyright 2017 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
9
10 use OpenSSL::Test qw/:DEFAULT srctop_file/;
11 use OpenSSL::Test::Utils;
12
13 setup("test_x509_check_cert_pkey");
14
15 plan tests => 6;
16
17 # rsa
18 ok(run(test(["x509_check_cert_pkey_test",
19 srctop_file("test", "certs", "servercert.pem"),
20 srctop_file("test", "certs", "serverkey.pem"), "cert", "ok"])));
21 # mismatched rsa
22 ok(run(test(["x509_check_cert_pkey_test",
23 srctop_file("test", "certs", "servercert.pem"),
24 srctop_file("test", "certs", "wrongkey.pem"), "cert", "failed"])));
25 SKIP: {
26 skip "DSA disabled", 1, if disabled("dsa");
27 # dsa
28 ok(run(test(["x509_check_cert_pkey_test",
29 srctop_file("test", "certs", "server-dsa-cert.pem"),
30 srctop_file("test", "certs", "server-dsa-key.pem"), "cert", "ok"])));
31 }
32 # ecc
33 SKIP: {
34 skip "EC disabled", 1 if disabled("ec");
35 ok(run(test(["x509_check_cert_pkey_test",
36 srctop_file("test", "certs", "server-ecdsa-cert.pem"),
37 srctop_file("test", "certs", "server-ecdsa-key.pem"), "cert", "ok"])));
38 }
39 # certificate request (rsa)
40 ok(run(test(["x509_check_cert_pkey_test",
41 srctop_file("test", "certs", "x509-check.csr"),
42 srctop_file("test", "certs", "x509-check-key.pem"), "req", "ok"])));
43 # mismatched certificate request (rsa)
44 ok(run(test(["x509_check_cert_pkey_test",
45 srctop_file("test", "certs", "x509-check.csr"),
46 srctop_file("test", "certs", "wrongkey.pem"), "req", "failed"])));