From 0cddb6a8a895c93b7f31d28d9bc5a78dc74865df Mon Sep 17 00:00:00 2001 From: Joakim Antman Date: Sat, 29 Oct 2022 11:31:06 +0300 Subject: [PATCH] A little cleanup for the tests --- test/openssl/test_pkey.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/openssl/test_pkey.rb b/test/openssl/test_pkey.rb index 7d746fdac..ed915e025 100644 --- a/test/openssl/test_pkey.rb +++ b/test/openssl/test_pkey.rb @@ -185,8 +185,8 @@ def test_from_parameters_with_invalid_alg def test_s_from_parameters_rsa_with_n_e_and_d_given_as_integers new_key = OpenSSL::PKey.from_parameters("RSA", n: 3161751493, - e: 65537, - d: 2064855961) + e: 65537, + d: 2064855961) assert_instance_of OpenSSL::PKey::RSA, new_key assert_equal true, new_key.private? @@ -197,8 +197,8 @@ def test_s_from_parameters_rsa_with_n_e_and_d_given_as_integers def test_s_from_parameters_rsa_with_n_e_and_d_given new_key = OpenSSL::PKey.from_parameters("RSA", "n" => OpenSSL::BN.new(3161751493), - "e" => OpenSSL::BN.new(65537), - "d" => OpenSSL::BN.new(2064855961)) + "e" => OpenSSL::BN.new(65537), + "d" => OpenSSL::BN.new(2064855961)) assert_instance_of OpenSSL::PKey::RSA, new_key assert_equal true, new_key.private? @@ -209,7 +209,7 @@ def test_s_from_parameters_rsa_with_n_e_and_d_given def test_s_from_parameters_rsa_with_n_and_e_given new_key = OpenSSL::PKey.from_parameters("RSA", n: OpenSSL::BN.new(3161751493), - e: OpenSSL::BN.new(65537)) + e: OpenSSL::BN.new(65537)) assert_instance_of OpenSSL::PKey::RSA, new_key assert_equal false, new_key.private? @@ -273,8 +273,8 @@ def test_s_from_parameters_rsa_with_invalid_parameter def test_s_from_parameters_ec_pub_given_as_string source = OpenSSL::PKey::EC.generate("prime256v1") - new_key = OpenSSL::PKey.from_parameters("EC", { group: source.group.curve_name, - pub: source.public_key.to_bn.to_s(2) }) + new_key = OpenSSL::PKey.from_parameters("EC", group: source.group.curve_name, + pub: source.public_key.to_bn.to_s(2)) assert_instance_of OpenSSL::PKey::EC, new_key assert_equal source.group.curve_name, new_key.group.curve_name assert_equal source.public_key, new_key.public_key @@ -283,8 +283,8 @@ def test_s_from_parameters_ec_pub_given_as_string def test_s_from_parameters_ec_priv_given_as_bn source = OpenSSL::PKey::EC.generate("prime256v1") - new_key = OpenSSL::PKey.from_parameters("EC", { group: source.group.curve_name, - priv: source.private_key.to_bn }) + new_key = OpenSSL::PKey.from_parameters("EC", group: source.group.curve_name, + priv: source.private_key.to_bn) assert_instance_of OpenSSL::PKey::EC, new_key assert_equal source.group.curve_name, new_key.group.curve_name assert_equal source.private_key, new_key.private_key @@ -293,8 +293,8 @@ def test_s_from_parameters_ec_priv_given_as_bn def test_s_from_parameters_ec_priv_given_as_integer source = OpenSSL::PKey::EC.generate("prime256v1") - new_key = OpenSSL::PKey.from_parameters("EC", { group: source.group.curve_name, - priv: source.private_key.to_i }) + new_key = OpenSSL::PKey.from_parameters("EC", group: source.group.curve_name, + priv: source.private_key.to_i) assert_instance_of OpenSSL::PKey::EC, new_key assert_equal source.group.curve_name, new_key.group.curve_name assert_equal source.private_key, new_key.private_key @@ -304,9 +304,9 @@ def test_s_from_parameters_ec_priv_given_as_integer def test_s_from_parameters_ec_priv_and_pub_given_for_different_curves ["prime256v1", "secp256k1", "secp384r1", "secp521r1"].each do |curve| source = OpenSSL::PKey::EC.generate(curve) - new_key = OpenSSL::PKey.from_parameters("EC", { group: source.group.curve_name, - pub: source.public_key.to_bn.to_s(2), - priv: source.private_key.to_i }) + new_key = OpenSSL::PKey.from_parameters("EC", group: source.group.curve_name, + pub: source.public_key.to_bn.to_s(2), + priv: source.private_key.to_i) assert_instance_of OpenSSL::PKey::EC, new_key assert_equal source.group.curve_name, new_key.group.curve_name assert_equal source.private_key, new_key.private_key