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