diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2017-03-23 18:35:11 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2017-03-23 18:35:11 +0900 |
commit | 380a5860be750d72ebf093aacbd09528f4259550 (patch) | |
tree | ff58552f001354c4277615a5be6b37adb5df77e8 /lib | |
parent | b7ae3765a033dbbc884a05636306c07522d360f2 (diff) | |
parent | 850fb5e9cfa5169f33a0843a6924d97a27edbd80 (diff) | |
download | ruby-openssl-380a5860be750d72ebf093aacbd09528f4259550.tar.gz |
Merge branch 'topic/kdf-module'
scrypt support is added.
* topic/kdf-module:
kdf: add scrypt
ossl.h: add NUM2UINT64T() macro
kdf: introduce OpenSSL::KDF module
Diffstat (limited to 'lib')
-rw-r--r-- | lib/openssl.rb | 1 | ||||
-rw-r--r-- | lib/openssl/pkcs5.rb | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/openssl.rb b/lib/openssl.rb index 26d167a9..09142829 100644 --- a/lib/openssl.rb +++ b/lib/openssl.rb @@ -19,3 +19,4 @@ require 'openssl/config' require 'openssl/digest' require 'openssl/x509' require 'openssl/ssl' +require 'openssl/pkcs5' diff --git a/lib/openssl/pkcs5.rb b/lib/openssl/pkcs5.rb new file mode 100644 index 00000000..959447df --- /dev/null +++ b/lib/openssl/pkcs5.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: false +#-- +# Ruby/OpenSSL Project +# Copyright (C) 2017 Ruby/OpenSSL Project Authors +#++ + +module OpenSSL + module PKCS5 + module_function + + # OpenSSL::PKCS5.pbkdf2_hmac has been renamed to OpenSSL::KDF.pbkdf2_hmac. + # This method is provided for backwards compatibility. + def pbkdf2_hmac(pass, salt, iter, keylen, digest) + OpenSSL::KDF.pbkdf2_hmac(pass, salt: salt, iterations: iter, + length: keylen, hash: digest) + end + + def pbkdf2_hmac_sha1(pass, salt, iter, keylen) + pbkdf2_hmac(pass, salt, iter, keylen, "sha1") + end + end +end |