Encrypting/Decrypting Data : openssl_public_encrypt « Network « PHP






Encrypting/Decrypting Data

 
<?php
$pkey = 'file:///etc/public_keys/dbkey.crt';
openssl_public_encrypt($_POST['credit_card'], $cryptnum, $pkey);
$sql = sprintf("INSERT INTO billing (userid, ccnum) values(%d, '%s')",$_SESSION['userid'], addslashes($cryptnum));
database_query($sql) or die('Unable to insert credit card data');
?>
  
  








Related examples in the same category