{"action":"reopened","issue":{"url":"https://api.github.com/repos/reidmorrison/symmetric-encryption/issues/54","labels_url":"https://api.github.com/repos/reidmorrison/symmetric-encryption/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/reidmorrison/symmetric-encryption/issues/54/comments","events_url":"https://api.github.com/repos/reidmorrison/symmetric-encryption/issues/54/events","html_url":"https://github.com/reidmorrison/symmetric-encryption/issues/54","id":112857992,"number":54,"title":"Trouble generating keys","user":{"login":"astjohn","id":47390,"avatar_url":"https://avatars.githubusercontent.com/u/47390?v=3","gravatar_id":"","url":"https://api.github.com/users/astjohn","html_url":"https://github.com/astjohn","followers_url":"https://api.github.com/users/astjohn/followers","following_url":"https://api.github.com/users/astjohn/following{/other_user}","gists_url":"https://api.github.com/users/astjohn/gists{/gist_id}","starred_url":"https://api.github.com/users/astjohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astjohn/subscriptions","organizations_url":"https://api.github.com/users/astjohn/orgs","repos_url":"https://api.github.com/users/astjohn/repos","events_url":"https://api.github.com/users/astjohn/events{/privacy}","received_events_url":"https://api.github.com/users/astjohn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-22T18:04:05Z","updated_at":"2015-10-23T02:34:13Z","closed_at":null,"body":"Hi,\r\n\r\nWe've just deployed our stack to our staging server and I'm having trouble generating the keys.\r\n\r\n\r\n```\r\n$ RAILS_ENV=staging bundle exec rails generate symmetric_encryption:new_keys staging\r\n\r\n=>\r\n\r\nSymmetric Encryption key file: '/opt/rails_keys/staging.key' not found or readable.\r\nTo generate the keys for the first time run: rails generate symmetric_encryption:new_keys\r\n\r\n\r\nSymmetric Encryption key file: '/opt/rails_keys/staging.iv' not found or readable.\r\nTo generate the keys for the first time run: rails generate symmetric_encryption:new_keys\r\n\r\nArgumentError: Missing mandatory parameter :key, :key_filename, or :encrypted_key\r\n                            initialize at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/symmetric-encryption-3.8.0/lib/symmetric_encryption/cipher.rb:190\r\n              block in extract_ciphers at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/symmetric-encryption-3.8.0/lib/symmetric_encryption/config.rb:66\r\n                               collect at org/jruby/RubyArray.java:2295\r\n                       extract_ciphers at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/symmetric-encryption-3.8.0/lib/symmetric_encryption/config.rb:65\r\n                                 load! at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/symmetric-encryption-3.8.0/lib/symmetric_encryption/config.rb:13\r\n                      block in Railtie at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/symmetric-encryption-3.8.0/lib/symmetric_encryption/railtie.rb:40\r\n                                  call at org/jruby/RubyProc.java:318\r\n                          execute_hook at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/activesupport-4.1.8/lib/active_support/lazy_load_hooks.rb:36\r\n               block in run_load_hooks at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/activesupport-4.1.8/lib/active_support/lazy_load_hooks.rb:45\r\n                                  each at org/jruby/RubyArray.java:1560\r\n                        run_load_hooks at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/activesupport-4.1.8/lib/active_support/lazy_load_hooks.rb:44\r\n                            initialize at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/railties-4.1.8/lib/rails/application.rb:123\r\n                              instance at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/railties-4.1.8/lib/rails/railtie.rb:171\r\n                             inherited at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/railties-4.1.8/lib/rails/application.rb:90\r\n                       <module:RailsApp> at /home/deploy/webroot/releases/20151022173918/config/application.rb:16\r\n                                 <top> at /home/deploy/webroot/releases/20151022173918/config/application.rb:15\r\n                               require at org/jruby/RubyKernel.java:939\r\n                                (root) at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:1\r\n  require_application_and_environment! at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:146\r\n                   generate_or_destroy at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:133\r\n                              generate at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:51\r\n                                 <top> at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40\r\n                               require at org/jruby/RubyKernel.java:939\r\n                                 <top> at /home/deploy/webroot/releases/20151022173918/vendor/bundle/jruby/2.2.0/gems/railties-4.1.8/lib/rails/commands.rb:17\r\n```\r\n\r\nOur config looks something like the following:\r\n\r\n```\r\n#\r\n# Symmetric Encryption for Ruby\r\n#\r\n---\r\n# For the development and test environments the test symmetric encryption keys\r\n# can be placed directly in the source code.\r\n# And therefore no RSA private key is required\r\ndevelopment:   &development_defaults\r\n  key:         1234567890ABCDEF1234567890ABCDEF\r\n  iv:          1234567890ABCDEF\r\n  cipher_name: aes-128-cbc\r\n  encoding:    :base64strict\r\n\r\ntest:\r\n  <<: *development_defaults\r\n\r\nstaging:\r\n  # Since the key to encrypt and decrypt with must NOT be stored along with the\r\n  # source code, we only hold a RSA key that is used to unlock the file\r\n  # containing the actual symmetric encryption key\r\n  private_rsa_key: |\r\n    -----BEGIN RSA PRIVATE KEY-----\r\n    RSA KEY DATA\r\n    -----END RSA PRIVATE KEY-----\r\n\r\n\r\n  # List Symmetric Key files in the order of current / latest first\r\n  ciphers:\r\n    -\r\n      # Filename containing Symmetric Encryption Key encrypted using the\r\n      # RSA public key derived from the private key above\r\n      key_filename: /opt/rails_keys/staging.key\r\n      iv_filename:  /opt/rails_keys/staging.iv\r\n      cipher_name:  aes-256-cbc\r\n      # Base64 encode encrypted data without newlines\r\n      encoding:     :base64strict\r\n      version:      1\r\n\r\nproduction:\r\n  # Since the key to encrypt and decrypt with must NOT be stored along with the\r\n  # source code, we only hold a RSA key that is used to unlock the file\r\n  # containing the actual symmetric encryption key\r\n  private_rsa_key: |\r\n    -----BEGIN RSA PRIVATE KEY-----\r\n    RSA KEY DATA\r\n    -----END RSA PRIVATE KEY-----\r\n\r\n\r\n  # List Symmetric Key files in the order of current / latest first\r\n  ciphers:\r\n    -\r\n      # Filename containing Symmetric Encryption Key encrypted using the\r\n      # RSA public key derived from the private key above\r\n      key_filename: /opt/rails_keys/production.key\r\n      iv_filename:  /opt/rails_keys/production.iv\r\n      cipher_name:  aes-256-cbc\r\n      # Base64 encode encrypted data without newlines\r\n      encoding:     :base64strict\r\n      version:      1\r\n\r\n```\r\n\r\nOur folders are 777 for the time being.\r\n\r\nYour help is greatly appreciated!"}}