]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/recipes/15-test_rsa.t
Add test cases for the non CA certificate with pathlen:0
[thirdparty/openssl.git] / test / recipes / 15-test_rsa.t
CommitLineData
596d6b7e
RS
1#! /usr/bin/env perl
2# Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
3#
909f1a2e 4# Licensed under the Apache License 2.0 (the "License"). You may not use
596d6b7e
RS
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
0c85cc50
RL
9
10use strict;
11use warnings;
12
13use File::Spec;
42e0ccdf 14use OpenSSL::Test qw/:DEFAULT srctop_file/;
340166a9 15use OpenSSL::Test::Utils;
0c85cc50
RL
16
17setup("test_rsa");
18
c5f87134
P
19#plan skip_all => "RSA command line tool not built"
20# if disabled("deprecated-3.0");
0c85cc50 21
c5f87134
P
22plan tests => 10;
23
24require_ok(srctop_file('test', 'recipes', 'tconversion.pl'));
0c85cc50
RL
25
26ok(run(test(["rsa_test"])), "running rsatest");
27
c5f87134 28run_rsa_tests("pkey");
464d59a5 29
0c85cc50 30 SKIP: {
c5f87134 31 skip "Skipping rsa command line tests", 4 if disabled('deprecated-3.0');
d8594555 32
c5f87134
P
33 run_rsa_tests("rsa");
34}
d8594555 35
c5f87134
P
36sub run_rsa_tests {
37 my $cmd = shift;
38
39 ok(run(app([ 'openssl', $cmd, '-check', '-in', srctop_file('test', 'testrsa.pem'), '-noout'])),
40 "$cmd -check" );
41
42 SKIP: {
43 skip "Skipping $cmd conversion test", 3
44 if disabled("rsa");
45
46 subtest "$cmd conversions -- private key" => sub {
47 tconversion($cmd, srctop_file("test", "testrsa.pem"));
48 };
49 subtest "$cmd conversions -- private key PKCS#8" => sub {
50 tconversion($cmd, srctop_file("test", "testrsa.pem"), "pkey");
51 };
52 }
53
54 SKIP: {
55 skip "Skipping msblob conversion test", 1
56 if disabled($cmd) || disabled("dsa") || $cmd == 'pkey';
57
58 subtest "$cmd conversions -- public key" => sub {
59 tconversion("msb", srctop_file("test", "testrsapub.pem"), "rsa",
60 "-pubin", "-pubout");
61 };
62 }
0c85cc50 63}