Module: OpenSSL
- Defined in:
- lib/openssl/bn.rb,
lib/openssl/ssl.rb,
lib/openssl/hmac.rb,
lib/openssl/x509.rb,
lib/jopenssl/load.rb,
lib/jopenssl/load.rb,
lib/openssl/cipher.rb,
lib/openssl/config.rb,
lib/openssl/digest.rb,
lib/openssl/pkcs12.rb,
lib/openssl/marshal.rb,
lib/jopenssl/_compat23.rb
Overview
–
Ruby-space definitions to add DER (de)serialization to classes
Info
‘OpenSSL for Ruby 2’ project Copyright © 2002 Michal Rokos <[email protected]> All rights reserved.
Licence
This program is licensed under the same licence as Ruby. (See the file ‘LICENCE’.) ++
Defined Under Namespace
Modules: Buffering, Marshal, PKey, SSL, X509 Classes: BN, Cipher, Config, ConfigError, Digest, HMAC, PKCS12
Class Method Summary collapse
-
.Digest(name) ⇒ Object
Returns a Digest subclass by name.
-
.secure_compare(a, b) ⇒ Object
call-seq: OpenSSL.secure_compare(string, string) -> boolean.
Class Method Details
.Digest(name) ⇒ Object
67 68 69 |
# File 'lib/openssl/digest.rb', line 67 def Digest(name) OpenSSL::Digest.const_get(name) end |
.secure_compare(a, b) ⇒ Object
call-seq:
OpenSSL.secure_compare(string, string) -> boolean
Constant time memory comparison. Inputs are hashed using SHA-256 to mask the length of the secret. Returns true
if the strings are identical, false
otherwise.
66 67 68 69 70 |
# File 'lib/jopenssl/load.rb', line 66 def self.secure_compare(a, b) hashed_a = OpenSSL::Digest.digest('SHA256', a) hashed_b = OpenSSL::Digest.digest('SHA256', b) OpenSSL.fixed_length_secure_compare(hashed_a, hashed_b) && a == b end |