lib/r509/ec-hack.rb in r509-0.10.0 vs lib/r509/ec-hack.rb in r509-1.0

- old
+ new

@@ -2,11 +2,11 @@ # as it is currently configured in ruby <= 2.0.0-p0 # the signing methods on OpenSSL::X509::Request and OpenSSL::X509::Certificate look for # a method named #private? on the PKey object. OpenSSL::PKey::RSA and OpenSSL::PKey::DSA # both define this method, but OpenSSL::PKey::EC defines #private_key? instead. This # will open up the class and add #private? as an alias to allow successful signing -if defined?(OpenSSL::PKey::EC) and not OpenSSL::PKey::EC.method_defined?('private?') +if defined?(OpenSSL::PKey::EC) && !OpenSSL::PKey::EC.method_defined?('private?') # marked as @private so it won't appear in the yard doc # @private module OpenSSL::PKey # marked as @private so it won't appear in the yard doc # @private @@ -14,11 +14,11 @@ def private? private_key? end end end -elsif not defined?(OpenSSL::PKey::EC) +elsif !defined?(OpenSSL::PKey::EC) # this is a stub implementation for when EC is unavailable. Any method called against # it will raise an R509Error # marked as @private so it won't appear in the yard doc # @private module OpenSSL::PKey @@ -27,9 +27,10 @@ class EC UNSUPPORTED = true def initialize(*args) raise R509::R509Error, "EC is unavailable. You may need to recompile Ruby with an OpenSSL that has elliptic curve support." end + def method_missing(method, *args, &block) raise R509::R509Error, "EC is unavailable. You may need to recompile Ruby with an OpenSSL that has elliptic curve support." end end end