Wrong final block length sharetribe

I upgrade sharetribe version to 7.3.1 and trying to configure stripe its fine for admin setting. Got enabled for admin but when I try to go to /settings/payments this page to enable for it for an individual person I am getting issue related cipher.final

In this method:
def decrypt_value(value)
cipher = OpenSSL::Cipher.new(‘AES-256-CBC’)
cipher.decrypt
cipher.key = Digest::SHA256.digest(APP_CONFIG.app_encryption_key)
cipher.padding = 0
plain = Base64.decode64(value)
cipher.iv = plain.slice!(0,16)
cipher.update(plain) + cipher.final
end
Issue:
OpenSSL::Cipher::CipherError - data not multiple of block length:
app/services/transaction_service/store/payment_settings.rb:178:in decrypt_value’ app/services/stripe_service/api/stripe_api_wrapper.rb:13:inconfigure_payment_for’

The issue is in the last line at cipher.final please let me know what is the issue?
and if possible its solution.

Thanks in advance

I just had the sameproblem here, resulting (presumably) from deleting a user from the database.

Solved it by regenerating the payment_setting/api_private_key in the database. This is generated from the app_encryption_key in the configuration, modified by arcane magicks before finding itself in the db.

To regenerate the key:

  1. Find payment_setting in the database
  2. Delete the following fields:
    api_private_key, api_publishable_key,api_verified,api_visible_public_key
  3. Change the app_encryption_key arbitrarily. It’s likely in config/config.defaults.yml
  4. Restart the http server (e.g., Puma, Unicorn)
  5. Navigate to /en/admin/payment_preferences in your browser
  6. Reenter your Stripe keys
  7. Test the users’ payment settings

In a live site, this could break payment settings. It’s also possible I didn’t need to clear every field or change the configuration secret key. Lots of possibilities, but this worked for me.