You are here

private function XMLSecurityKey::decryptOpenSSL in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8

Decrypts the given data (string) using the openssl-extension

Parameters

string $data:

Return value

string

Throws

Exception

1 call to XMLSecurityKey::decryptOpenSSL()
XMLSecurityKey::decryptData in src/XMLSecurityKey.php
Decrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.

File

src/XMLSecurityKey.php, line 444

Class

XMLSecurityKey

Namespace

Drupal\miniorange_saml

Code

private function decryptOpenSSL($data) {
  if ($this->cryptParams['type'] == 'public') {
    if (!openssl_public_decrypt($data, $decrypted, $this->key, $this->cryptParams['padding'])) {
      throw new Exception('Failure decrypting Data');
    }
  }
  else {
    if (!openssl_private_decrypt($data, $decrypted, $this->key, $this->cryptParams['padding'])) {
      throw new Exception('Failure decrypting Data');
    }
  }
  return $decrypted;
}