You are here

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

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 includes/XMLSecurityKey.php
Decrypts the given data (string) using the regarding php-extension, depending on the library assigned to algorithm in the contructor.

File

includes/XMLSecurityKey.php, line 477

Class

XMLSecurityKey

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;
}