You are here

function uc_credit_encryption_key in Ubercart 8.4

Same name and namespace in other branches
  1. 5 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.

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.

12 calls to uc_credit_encryption_key()
AuthorizeNet::buildConfigurationForm in payment/uc_authorizenet/src/Plugin/Ubercart/PaymentMethod/AuthorizeNet.php
Form constructor.
AuthorizeNet::submitConfigurationForm in payment/uc_authorizenet/src/Plugin/Ubercart/PaymentMethod/AuthorizeNet.php
Form submission handler.
CreditCardPaymentMethodBase::cartProcess in payment/uc_credit/src/CreditCardPaymentMethodBase.php
Called when checkout is submitted with this payment method selected.
CreditCardPaymentMethodBase::orderSave in payment/uc_credit/src/CreditCardPaymentMethodBase.php
Called when an order is being saved with this payment method.
CreditCardTest::configureCreditCard in payment/uc_credit/tests/src/Functional/CreditCardTest.php
Helper function to configure Credit Card payment method settings.

... See full list

File

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

Code

function uc_credit_encryption_key() {
  static $key = FALSE;
  if (empty($key)) {
    $config = \Drupal::config('uc_credit.settings');
    $key_file = $config
      ->get('encryption_path') . '/' . UC_CREDIT_KEYFILE_NAME;
    $contents = @file_get_contents($key_file);
    if (strlen($contents) == 32) {
      $key = $contents;
    }
  }
  return $key;
}