2
0

20-test_spkac.t 1.3 KB

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