From 1f9da0cd9d1dbb7043e5a91646abd8866539d3c1 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Fri, 10 Jul 2020 13:43:20 +0900 Subject: pkey/ec: refactor EC#dsa_{sign,verify}_asn1 with PKey#{sign,verify}_raw With the newly added OpenSSL::PKey::PKey#{sign,verify}_raw, OpenSSL::PKey::EC's low level signing operation methods can be implemented in Ruby. The definitions are now in lib/openssl/pkey.rb. --- lib/openssl/pkey.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib') diff --git a/lib/openssl/pkey.rb b/lib/openssl/pkey.rb index dd8c7c0b..e5871096 100644 --- a/lib/openssl/pkey.rb +++ b/lib/openssl/pkey.rb @@ -164,6 +164,28 @@ module OpenSSL::PKey class EC include OpenSSL::Marshal + # :call-seq: + # key.dsa_sign_asn1(data) -> String + # + # Deprecated in version 3.0. + # Consider using PKey::PKey#sign_raw and PKey::PKey#verify_raw instead. + def dsa_sign_asn1(data) + sign_raw(nil, data) + rescue OpenSSL::PKey::PKeyError + raise OpenSSL::PKey::ECError, $!.message + end + + # :call-seq: + # key.dsa_verify_asn1(data, sig) -> true | false + # + # Deprecated in version 3.0. + # Consider using PKey::PKey#sign_raw and PKey::PKey#verify_raw instead. + def dsa_verify_asn1(data, sig) + verify_raw(nil, sig, data) + rescue OpenSSL::PKey::PKeyError + raise OpenSSL::PKey::ECError, $!.message + end + # :call-seq: # ec.dh_compute_key(pubkey) -> string # -- cgit v1.2.3