سؤال

I get past step 2 when setting up the sekrets gem for use with a Sinatra app. Both files ".sekrets.key" and "config/settings.yml.enc" are created, which respectively contain the key and the encrypted value. But when I run:

$ sekrets read config/settings.yml.enc

or

$ sekrets edit config/settings.yml.enc

I receive the following error:

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>'

I've checked the lines responsible for the errors in sekrets.rb, but can't figure out why or how this is happening.

هل كانت مفيدة؟

المحلول

When I created the key and encrypted file, I named the keypair "abcd". When I put the decryption key in a file, I accidentally echoed "abc" instead of "abcd".

The problem was a typo. T_T

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top