openssl_pkcs7_decrypt
openssl_pkcs7_decrypt
(PHP 4 >= 4.0.6, PHP 5, PHP 7)
openssl_pkcs7_decrypt — 解密S / MIME加密的消息
描述
bool openssl_pkcs7_decrypt ( string $infilename , string $outfilename , mixed $recipcert [, mixed $recipkey ] )
解密infilename
使用由recipcert
and 指定的证书及其关联私钥指定的文件中包含的S / MIME加密消息recipkey
。
参数
infilename
outfilename
解密的消息被写入由outfilename
指定的文件。
recipcert
recipkey
返回值
成功时返回TRUE
或失败时返回FALSE
。
例子
示例#1 openssl_pkcs7_decrypt()示例
<?php
// $cert and $key are assumed to contain your personal certificate and private
// key pair, and that you are the recipient of an S/MIME message
$infilename = "encrypted.msg"; // this file holds your encrypted message
$outfilename = "decrypted.msg"; // make sure you can write to this file
if (openssl_pkcs7_decrypt($infilename, $outfilename, $cert, $key)) {
echo "decrypted!";
} else {
echo "failed to decrypt!";
}
?>
← openssl_pkcs12_read
openssl_pkcs7_encrypt →