diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2020-07-10 13:43:20 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2021-05-25 18:58:13 +0900 |
commit | 1f9da0cd9d1dbb7043e5a91646abd8866539d3c1 (patch) | |
tree | ecb5322c65848b1f985c653bf943b049b4ad300b /lib | |
parent | 2dfc1779d3ffd1a62f8053362c3b98321c3dc083 (diff) | |
download | ruby-openssl-1f9da0cd9d1dbb7043e5a91646abd8866539d3c1.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/openssl/pkey.rb | 22 |
1 files changed, 22 insertions, 0 deletions
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 @@ -165,6 +165,28 @@ module OpenSSL::PKey include OpenSSL::Marshal # :call-seq: + # key.dsa_sign_asn1(data) -> String + # + # <b>Deprecated in version 3.0</b>. + # 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 + # + # <b>Deprecated in version 3.0</b>. + # 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 # # Derives a shared secret by ECDH. _pubkey_ must be an instance of |