You are here

function uc_credit_encryption_key in Ubercart 5

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

Loads the key for CC number encryption from a file.

Return value

FALSE if no encryption key is found.

16 calls to uc_credit_encryption_key()
hook_store_status in docs/hooks.php
Add status messages to the "Store administration" page.
uc_authorizenet_payment_gateway_settings_submit in payment/uc_authorizenet/uc_authorizenet.module
uc_credit_cache in payment/uc_credit/uc_credit.module
Caches CC details on a pageload for use in various functions.
uc_credit_cron in payment/uc_credit/uc_credit.module
Implementation of hook_cron().
uc_credit_encrypt_existing in payment/uc_credit/uc_credit.module

... See full list

File

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

Code

function uc_credit_encryption_key() {
  static $key;
  if (!empty($key)) {
    return $key;
  }
  $dir = variable_get('uc_credit_encryption_path', t('Not configured, see below.'));
  if (!empty($dir) && $dir !== t('Not configured, see below.')) {
    $filename = rtrim($dir, '/\\') . '/uc_credit.key';
    if (file_exists($filename)) {
      if (!($file = fopen($filename, 'r'))) {
        return FALSE;
      }
      $key = fread($file, filesize($filename));
      fclose($file);
    }
  }
  else {
    return FALSE;
  }
  return $key;
}