You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.
try {
$symmetric = newSymmetricEncryption();
$encrypted = /* get encrypted data from database */;
$iv = /* get iv from database */;
$decrypted = $symmetric->decrypt($encrypted, 'MyPassphrase', $iv);
} catch (EncryptionException$e) {
echo"Something went wrong...";
}
Asymetric encryption
Generate private/public key pair
try {
$asymmetric = newAsymmetricEncryption();
$publicKey = $asymmetric->getPublicKey(); // or export to a file$privateKey = $asymmetric->getPrivateKey('MyPassphrase'); // or export to a file$encrypted = $asymmetric->encrypt('String to encrypt', $publicKey);
} catch (EncryptionException$e) {
echo"Something went wrong...";
}
Decrypt with private key
try {
$asymmetric = newAsymmetricEncryption();
$privateKey = /* get private key */;
$encrypted = /* get encrypted data */;
$decrypted = $asymmetric->decrypt($encrypted, $privateKey, 'MyPassphrase');
} catch (EncryptionException$e) {
echo"Something went wrong...";
}