1 #! /usr/bin/env perl 2 # Copyright 2021 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 use strict; 10 use warnings; 11 12 use File::Spec; 13 use File::Basename; 14 use OpenSSL::Test qw/:DEFAULT srctop_file ok_nofips/; 15 use OpenSSL::Test::Utils; 16 17 setup("test_spkac"); 18 19 plan skip_all => "RSA is not supported by this OpenSSL build" 20 if disabled("rsa"); 21 22 plan tests => 4; 23 24 # For the tests below we use the cert itself as the TBS file 25 26 SKIP: { 27 skip "MD5 is not supported by this OpenSSL build", 2 28 if disabled("md5"); 29 30 ok(run(app([ 'openssl', 'spkac', '-key', srctop_file("test", "testrsa.pem"), 31 '-out', 'spkac-md5.pem'])), 32 "SPKAC MD5"); 33 ok(run(app([ 'openssl', 'spkac', '-in', 'spkac-md5.pem'])), 34 "SPKAC MD5 verify"); 35 } 36 37 ok(run(app([ 'openssl', 'spkac', '-key', srctop_file("test", "testrsa.pem"), 38 '-out', 'spkac-sha256.pem', '-digest', 'sha256'])), 39 "SPKAC SHA256"); 40 ok(run(app([ 'openssl', 'spkac', '-in', 'spkac-sha256.pem'])), 41 "SPKAC SHA256 verify"); 42