首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

openssl_pkcs7_decrypt

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

openssl_pkcs7_decrypt — 解密S / MIME加密的消息

描述

代码语言:javascript
复制
bool openssl_pkcs7_decrypt ( string $infilename , string $outfilename , mixed $recipcert [, mixed $recipkey ] )

解密infilename使用由recipcertand 指定的证书及其关联私钥指定的文件中包含的S / MIME加密消息recipkey

参数

infilename outfilename

解密的消息被写入由outfilename指定的文件。

recipcert recipkey

返回值

成功时返回TRUE或失败时返回FALSE

例子

示例#1 openssl_pkcs7_decrypt()示例

代码语言:javascript
复制
<?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 →

扫码关注腾讯云开发者

领取腾讯云代金券