]>
Commit | Line | Data |
---|---|---|
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 | |
10 | use strict; | |
11 | use warnings; | |
12 | ||
13 | use File::Spec; | |
42e0ccdf | 14 | use OpenSSL::Test qw/:DEFAULT srctop_file/; |
340166a9 | 15 | use OpenSSL::Test::Utils; |
0c85cc50 RL |
16 | |
17 | setup("test_rsa"); | |
18 | ||
c5f87134 P |
19 | plan tests => 10; |
20 | ||
21 | require_ok(srctop_file('test', 'recipes', 'tconversion.pl')); | |
0c85cc50 RL |
22 | |
23 | ok(run(test(["rsa_test"])), "running rsatest"); | |
24 | ||
c5f87134 | 25 | run_rsa_tests("pkey"); |
464d59a5 | 26 | |
b0cfe526 | 27 | run_rsa_tests("rsa"); |
d8594555 | 28 | |
c5f87134 P |
29 | sub run_rsa_tests { |
30 | my $cmd = shift; | |
31 | ||
32 | ok(run(app([ 'openssl', $cmd, '-check', '-in', srctop_file('test', 'testrsa.pem'), '-noout'])), | |
33 | "$cmd -check" ); | |
34 | ||
35 | SKIP: { | |
36 | skip "Skipping $cmd conversion test", 3 | |
37 | if disabled("rsa"); | |
38 | ||
39 | subtest "$cmd conversions -- private key" => sub { | |
40 | tconversion($cmd, srctop_file("test", "testrsa.pem")); | |
41 | }; | |
42 | subtest "$cmd conversions -- private key PKCS#8" => sub { | |
43 | tconversion($cmd, srctop_file("test", "testrsa.pem"), "pkey"); | |
44 | }; | |
45 | } | |
46 | ||
47 | SKIP: { | |
48 | skip "Skipping msblob conversion test", 1 | |
49 | if disabled($cmd) || disabled("dsa") || $cmd == 'pkey'; | |
50 | ||
51 | subtest "$cmd conversions -- public key" => sub { | |
52 | tconversion("msb", srctop_file("test", "testrsapub.pem"), "rsa", | |
53 | "-pubin", "-pubout"); | |
54 | }; | |
55 | } | |
0c85cc50 | 56 | } |