【发布时间】:2013-12-28 17:18:11
【问题描述】:
我将 Ruby 2.0.0 Openssl module 用于我的加密/解密逻辑之一。它在我的 Mac 上完美运行,但是当我在企业 SUSE 服务器上使用相同的代码时,它会引发以下错误。
irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> cipher = OpenSSL::Cipher.new 'AES-128-CBC'
=> #<OpenSSL::Cipher:0x007f240fb07888>
irb(main):003:0> cipher.encrypt
=> #<OpenSSL::Cipher:0x007f240fb07888>
irb(main):004:0> iv = cipher.random_iv
=> "\x84R\xCF\x97.\x17\xD1h2\xBB{6\xB8\"\xD1\xC5"
irb(main):005:0>
irb(main):006:0* pwd = 'some hopefully not to easily guessable password'
=> "some hopefully not to easily guessable password"
irb(main):007:0> salt = OpenSSL::Random.random_bytes 16
=> "#\xBCB\x05\xDE=\x83\xE8IOxR'\xBFRa"
irb(main):008:0> iter = 20000
=> 20000
irb(main):009:0> key_len = cipher.key_len
=> 16
irb(main):010:0> digest = OpenSSL::Digest::SHA256.new
=> #<OpenSSL::Digest::SHA256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
irb(main):011:0>
irb(main):012:0* key = OpenSSL::PKCS5.pbkdf2_hmac(pwd, salt, iter, key_len, digest)
NotImplementedError: pbkdf2_hmac() function is unimplemented on this machine
from (irb):12:in `pbkdf2_hmac'
from (irb):12
提前致谢!
【问题讨论】:
标签: ruby openssl ruby-2.0 opensuse