Page tree
Skip to end of metadata
Go to start of metadata

If you configured Blesta with a Private Key Passphrase, and you've forgotten it, you'll be unable to process Credit Card and ACH payments. You will also be unable to recover any Credit Card or ACH payment details. However, this guide will walk you through the steps for regenerating an encryption key set that will allow you to again begin accepting and processing new Credit Card and ACH payments.

Regenerating a new encryption key pair

  1. Backup your database.
  2. Determine which company_id you need to generate a new encryption key pair for. You can find this under System > Companies. Click edit and look for the number at the end in the URL bar.
  3. Remove the existing private_keypublic_key, and private_key_passphrase values stored for your company_id from the company_setting table. The following is a query that will do just that (replace COMPANYID with your actual company ID).

    Remove key pair query
    UPDATE `company_settings` SET `value`='' WHERE `company_id`=COMPANYID AND `key` IN ('private_key', 'public_key', 'private_key_passphrase')
  4. Find your API key. If you don't already have an API user, create one.
  5. SSH into your server and navigate to the directory where Blesta is installed.
  6. Execute the following command, replacing USER with your API username, KEY with your API user key, and COMPANYID with your company ID.

    php index.php api/companies/generateKeyPair.json -u USER -k KEY -m POST -p "company_id=COMPANYID&bits=3072"

    Generating encryption keys is hard work. This may take a minute or so to complete. When finished you should receive output similar to

    {"response":{"privatekey":"-----BEGIN RSA PRIVATE KEY-----\nMIIG4wIBAAKCAYEAr8kl
    87IAUSUFaXVNARrPvx1PzZhYU+f7i2xQvIqnVwLfmTU+\n6myDcmCerTWru3XpFciWl2nEeR52DAQaaR
    7YwZr8L4chJmly9AbIUuxW1eml59y+\nytz+Yl6fdxfVpmSSeYUv6+xX6CFaF49R3OkFhcm6FxzY9RxM
    ...
  7. You're done! You can now go back into Blesta and set a new Private Key Passphrase if you want.