1*b0d17251Schristos#! /usr/bin/env perl 2*b0d17251Schristos# Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. 3*b0d17251Schristos# 4*b0d17251Schristos# Licensed under the Apache License 2.0 (the "License"). You may not use 5*b0d17251Schristos# this file except in compliance with the License. You can obtain a copy 6*b0d17251Schristos# in the file LICENSE in the source distribution or at 7*b0d17251Schristos# https://www.openssl.org/source/license.html 8*b0d17251Schristos 9*b0d17251Schristosuse strict; 10*b0d17251Schristosuse warnings; 11*b0d17251Schristos 12*b0d17251Schristosuse File::Spec; 13*b0d17251Schristosuse File::Basename; 14*b0d17251Schristosuse OpenSSL::Test qw/:DEFAULT srctop_file ok_nofips/; 15*b0d17251Schristosuse OpenSSL::Test::Utils; 16*b0d17251Schristos 17*b0d17251Schristossetup("test_spkac"); 18*b0d17251Schristos 19*b0d17251Schristosplan skip_all => "RSA is not supported by this OpenSSL build" 20*b0d17251Schristos if disabled("rsa"); 21*b0d17251Schristos 22*b0d17251Schristosplan tests => 4; 23*b0d17251Schristos 24*b0d17251Schristos# For the tests below we use the cert itself as the TBS file 25*b0d17251Schristos 26*b0d17251SchristosSKIP: { 27*b0d17251Schristos skip "MD5 is not supported by this OpenSSL build", 2 28*b0d17251Schristos if disabled("md5"); 29*b0d17251Schristos 30*b0d17251Schristos ok(run(app([ 'openssl', 'spkac', '-key', srctop_file("test", "testrsa.pem"), 31*b0d17251Schristos '-out', 'spkac-md5.pem'])), 32*b0d17251Schristos "SPKAC MD5"); 33*b0d17251Schristos ok(run(app([ 'openssl', 'spkac', '-in', 'spkac-md5.pem'])), 34*b0d17251Schristos "SPKAC MD5 verify"); 35*b0d17251Schristos} 36*b0d17251Schristos 37*b0d17251Schristosok(run(app([ 'openssl', 'spkac', '-key', srctop_file("test", "testrsa.pem"), 38*b0d17251Schristos '-out', 'spkac-sha256.pem', '-digest', 'sha256'])), 39*b0d17251Schristos "SPKAC SHA256"); 40*b0d17251Schristosok(run(app([ 'openssl', 'spkac', '-in', 'spkac-sha256.pem'])), 41*b0d17251Schristos "SPKAC SHA256 verify"); 42