" OpenSSL的::密码:CipherError"设置sekrets gem时收到。为什么?

时间:2014-05-07 00:25:29

标签: ruby encryption openssl sinatra

设置sekrets gem以便与Sinatra应用程序一起使用时,我已经过了第2步。两个文件" .sekrets.key"和" config / settings.yml.enc"创建,分别包含密钥和加密值。但是当我跑步时:

$ sekrets read config/settings.yml.enc

$ sekrets edit config/settings.yml.enc

我收到以下错误:

F, [2014-05-06T16:48:05.850486 #31312] FATAL -- : bad decrypt (OpenSSL::Cipher::CipherError)
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/lib/sekrets.rb:297:in `final'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/lib/sekrets.rb:297:in `cipher'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/lib/sekrets.rb:305:in `decrypt'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/bin/sekrets:224:in `block (2 levels) in run'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/lib/sekrets.rb:185:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/lib/sekrets.rb:185:in `openw'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/bin/sekrets:222:in `block in run'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/lib/sekrets.rb:217:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/lib/sekrets.rb:217:in `openr'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/bin/sekrets:219:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/main-6.0.0/lib/main/program/class_methods.rb:155:in `block in run'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/main-6.0.0/lib/main/program/class_methods.rb:144:in `catch'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/main-6.0.0/lib/main/program/class_methods.rb:144:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/main-6.0.0/lib/main/factories.rb:18:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/main-6.0.0/lib/main/factories.rb:25:in `Main'
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/sekrets-1.7.0/bin/sekrets:3:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/sekrets:23:in `load'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/sekrets:23:in `<main>'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'

我已经检查了sekrets.rb中导致错误的行,但无法弄清楚为什么或如何发生这种情况。

1 个答案:

答案 0 :(得分:1)

当我创建密钥和加密文件时,我将密钥对命名为“abcd”。当我把解密密钥放在一个文件中时,我不小心回复了“abc”而不是“abcd”。

这个问题是一个错字。 T_T