15-test_ec.t 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #! /usr/bin/env perl
  2. # Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the OpenSSL license (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 OpenSSL::Test qw/:DEFAULT srctop_file/;
  12. use OpenSSL::Test::Utils;
  13. setup("test_ec");
  14. plan tests => 11;
  15. require_ok(srctop_file('test','recipes','tconversion.pl'));
  16. ok(run(test(["ectest"])), "running ectest");
  17. SKIP: {
  18. skip "Skipping EC conversion test", 3
  19. if disabled("ec");
  20. subtest 'EC conversions -- private key' => sub {
  21. tconversion("ec", srctop_file("test","testec-p256.pem"));
  22. };
  23. subtest 'EC conversions -- private key PKCS#8' => sub {
  24. tconversion("ec", srctop_file("test","testec-p256.pem"), "pkey");
  25. };
  26. subtest 'EC conversions -- public key' => sub {
  27. tconversion("ec", srctop_file("test","testecpub-p256.pem"),
  28. "ec", "-pubin", "-pubout");
  29. };
  30. }
  31. SKIP: {
  32. skip "Skipping EdDSA conversion test", 6
  33. if disabled("ec");
  34. subtest 'Ed25519 conversions -- private key' => sub {
  35. tconversion("pkey", srctop_file("test","tested25519.pem"));
  36. };
  37. subtest 'Ed25519 conversions -- private key PKCS#8' => sub {
  38. tconversion("pkey", srctop_file("test","tested25519.pem"), "pkey");
  39. };
  40. subtest 'Ed25519 conversions -- public key' => sub {
  41. tconversion("pkey", srctop_file("test","tested25519pub.pem"),
  42. "pkey", "-pubin", "-pubout");
  43. };
  44. subtest 'Ed448 conversions -- private key' => sub {
  45. tconversion("pkey", srctop_file("test","tested448.pem"));
  46. };
  47. subtest 'Ed448 conversions -- private key PKCS#8' => sub {
  48. tconversion("pkey", srctop_file("test","tested448.pem"), "pkey");
  49. };
  50. subtest 'Ed448 conversions -- public key' => sub {
  51. tconversion("pkey", srctop_file("test","tested448pub.pem"),
  52. "pkey", "-pubin", "-pubout");
  53. };
  54. }