You are here

function uc_credit_encryption_key in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 payment/uc_credit/uc_credit.module \uc_credit_encryption_key()
  2. 5 payment/uc_credit/uc_credit.module \uc_credit_encryption_key()
  3. 6.2 payment/uc_credit/uc_credit.module \uc_credit_encryption_key()

Loads the key for CC number encryption from a file.

Path to key file is stored in system variable 'uc_credit_encryption_path'. Key file name is stored in constant UC_CREDIT_KEYFILE_NAME.

Return value

string|false Key, or FALSE if no encryption key is found.

17 calls to uc_credit_encryption_key()
hook_uc_store_status in uc_store/uc_store.api.php
Adds status messages to the "Store administration" page.
UbercartCreditCardTestCase::configureCreditCard in payment/uc_credit/tests/uc_credit.test
Helper function to configure Credit Card payment method settings.
UbercartCreditCardTestCase::testSecuritySettings in payment/uc_credit/tests/uc_credit.test
Tests security settings configuration.
uc_authorizenet_payment_gateway_settings_submit in payment/uc_authorizenet/uc_authorizenet.module
Submit handler for payment gateway settings form to encrypt fields.
uc_credit_cache in payment/uc_credit/uc_credit.module
Caches CC details on a pageload for use in various functions.

... See full list

File

payment/uc_credit/uc_credit.module, line 951
Defines the credit card payment method and hooks in payment gateways.

Code

function uc_credit_encryption_key() {
  static $key = FALSE;
  if (empty($key)) {
    $key_file = variable_get('uc_credit_encryption_path', '') . '/' . UC_CREDIT_KEYFILE_NAME;
    $contents = @file_get_contents($key_file);
    if (strlen($contents) == 32) {
      $key = $contents;
    }
  }
  return $key;
}