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