15-test_ec.t 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #! /usr/bin/env perl
  2. # Copyright 2015-2020 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 OpenSSL::Test qw/:DEFAULT srctop_file/;
  12. use OpenSSL::Test::Utils;
  13. setup("test_ec");
  14. plan tests => 14;
  15. require_ok(srctop_file('test','recipes','tconversion.pl'));
  16. ok(run(test(["ectest"])), "running ectest");
  17. # TODO: remove these when the 'ec' app is removed.
  18. # Also consider moving this to the 20-25 test section because it is testing
  19. # the command line tool in addition to the algorithm.
  20. SKIP: {
  21. skip "Skipping EC conversion test", 3
  22. if disabled("ec");
  23. subtest 'EC conversions -- private key' => sub {
  24. tconversion("ec", srctop_file("test","testec-p256.pem"));
  25. };
  26. subtest 'EC conversions -- private key PKCS#8' => sub {
  27. tconversion("ec", srctop_file("test","testec-p256.pem"), "pkey");
  28. };
  29. subtest 'EC conversions -- public key' => sub {
  30. tconversion("ec", srctop_file("test","testecpub-p256.pem"),
  31. "ec", "-pubin", "-pubout");
  32. };
  33. }
  34. SKIP: {
  35. skip "Skipping PKEY conversion test", 3
  36. if disabled("ec");
  37. subtest 'PKEY conversions -- private key' => sub {
  38. tconversion("pkey", srctop_file("test","testec-p256.pem"));
  39. };
  40. subtest 'PKEY conversions -- private key PKCS#8' => sub {
  41. tconversion("pkey", srctop_file("test","testec-p256.pem"), "pkey");
  42. };
  43. subtest 'PKEY conversions -- public key' => sub {
  44. tconversion("pkey", srctop_file("test","testecpub-p256.pem"),
  45. "pkey", "-pubin", "-pubout");
  46. };
  47. }
  48. SKIP: {
  49. skip "Skipping EdDSA conversion test", 6
  50. if disabled("ec");
  51. subtest 'Ed25519 conversions -- private key' => sub {
  52. tconversion("pkey", srctop_file("test", "tested25519.pem"));
  53. };
  54. subtest 'Ed25519 conversions -- private key PKCS#8' => sub {
  55. tconversion("pkey", srctop_file("test", "tested25519.pem"), "pkey");
  56. };
  57. subtest 'Ed25519 conversions -- public key' => sub {
  58. tconversion("pkey", srctop_file("test", "tested25519pub.pem"),
  59. "pkey", "-pubin", "-pubout");
  60. };
  61. subtest 'Ed448 conversions -- private key' => sub {
  62. tconversion("pkey", srctop_file("test", "tested448.pem"));
  63. };
  64. subtest 'Ed448 conversions -- private key PKCS#8' => sub {
  65. tconversion("pkey", srctop_file("test", "tested448.pem"), "pkey");
  66. };
  67. subtest 'Ed448 conversions -- public key' => sub {
  68. tconversion("pkey", srctop_file("test", "tested448pub.pem"),
  69. "pkey", "-pubin", "-pubout");
  70. };
  71. }