RobRichards\XMLSecLibs\XMLSecurityKey::encryptOpenSSL PHP Method

encryptOpenSSL() private method

Encrypts the given data (string) using the openssl-extension
private encryptOpenSSL ( string $data ) : string
$data string
return string
    private function encryptOpenSSL($data)
    {
        if ($this->cryptParams['type'] == 'public') {
            if (!openssl_public_encrypt($data, $encrypted_data, $this->key, $this->cryptParams['padding'])) {
                throw new Exception('Failure encrypting Data');
            }
        } else {
            if (!openssl_private_encrypt($data, $encrypted_data, $this->key, $this->cryptParams['padding'])) {
                throw new Exception('Failure encrypting Data');
            }
        }
        return $encrypted_data;
    }