Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read
Q&A

How to deal with OpenSSL::Cipher::CipherError when editing QPixel's credentials Question

+0
−0

On Ubuntu 20.04 (WSL) I wanted to provide an arbitrary, non-empty Stripe API key and following this answer by Art edit the credentials accordingly.

export EDITOR=vim
bin/rails credentials:edit

However, that gave an OpenSSL::Cipher::CipherError

Traceback (most recent call last):
        31: from bin/rails:3:in `<main>'
        30: from bin/rails:3:in `load'
        29: from /home/abanta/qpixel/bin/spring:13:in `<top (required)>'
        28: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        27: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        26: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
        25: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
        24: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
        23: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
        22: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
        21: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
        20: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
        19: from /home/abanta/qpixel/bin/rails:9:in `<top (required)>'
        18: from /home/abanta/qpixel/bin/rails:9:in `require'
        17: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/commands.rb:18:in `<top (required)>'
        16: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/command.rb:46:in `invoke'
        15: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/command/base.rb:69:in `perform'
        14: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        13: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        12: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        11: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/commands/credentials/credentials_command.rb:26:in `edit'
        10: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/command/helpers/editor.rb:26:in `catch_editing_exceptions'
         9: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/commands/credentials/credentials_command.rb:27:in `block in edit'
         8: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/commands/credentials/credentials_command.rb:50:in `change_credentials_in_system_editor'
         7: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/encrypted_file.rb:54:in `change'
         6: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/encrypted_configuration.rb:21:in `read'
         5: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/encrypted_file.rb:42:in `read'
         4: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/encrypted_file.rb:79:in `decrypt'
         3: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
         2: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
         1: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/message_encryptor.rb:201:in `_decrypt'
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/message_encryptor.rb:201:in `final': OpenSSL::Cipher::CipherError
        31: from bin/rails:3:in `<main>'
        30: from bin/rails:3:in `load'
        29: from /home/abanta/qpixel/bin/spring:13:in `<top (required)>'
        28: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        27: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        26: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
        25: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
        24: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
        23: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
        22: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
        21: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
        20: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
        19: from /home/abanta/qpixel/bin/rails:9:in `<top (required)>'
        18: from /home/abanta/qpixel/bin/rails:9:in `require'
        17: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/commands.rb:18:in `<top (required)>'
        16: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/command.rb:46:in `invoke'
        15: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/command/base.rb:69:in `perform'
        14: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        13: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        12: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        11: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/commands/credentials/credentials_command.rb:26:in `edit'
        10: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/command/helpers/editor.rb:26:in `catch_editing_exceptions'
         9: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/commands/credentials/credentials_command.rb:27:in `block in edit'
         8: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/commands/credentials/credentials_command.rb:50:in `change_credentials_in_system_editor'
         7: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/encrypted_file.rb:54:in `change'
         6: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/encrypted_configuration.rb:21:in `read'
         5: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/encrypted_file.rb:42:in `read'
         4: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/encrypted_file.rb:79:in `decrypt'
         3: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
         2: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
         1: from /home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/message_encryptor.rb:183:in `_decrypt'
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt': ActiveSupport::MessageEncryptor::InvalidMessage (ActiveSupport::MessageEncryptor::InvalidMessage)

The internet isn't clear what that means. I may miss a password maybe to access the content of credentials.yml.enc?

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+1
−0

The error is actually a ActiveSupport::MessageEncryptor::InvalidMessage, which means either the message you're trying to decrypt is corrupted (it isn't), or you have the wrong key. Since the credentials.yml.enc in the repo is the production credentials, the key for this is stored separately.

For development, just delete the file and when you run credentials:edit it'll be recreated for you with a valid key.

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!

Like what we're doing? Support us! Donate