openssl_open

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

openssl_open锟斤拷锟杰凤拷锟斤拷锟斤拷锟�

说锟斤拷

openssl_open ( string $sealed_data , string &$open_data , string $env_key , mixed $priv_key_id [, string $method = "RC4" [, string &$iv ]] ) : bool

openssl_open() 使锟斤拷锟斤拷锟斤拷钥锟斤拷识锟斤拷priv_key_id锟斤拷锟脚凤拷锟斤拷钥env_key锟斤拷锟斤拷锟斤拷锟剿皆匡拷锟� (锟斤拷锟斤拷) sealed_data 锟斤拷锟斤拷, 使锟矫斤拷锟杰猴拷锟斤拷锟斤拷锟斤拷锟斤拷open_data锟斤拷 锟斤拷锟斤拷锟捷憋拷锟杰凤拷时锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟脚凤拷锟斤拷钥锟斤拷只锟斤拷锟斤拷一锟斤拷锟截讹拷锟斤拷私钥使锟矫★拷锟斤拷锟斤拷锟斤拷息锟轿硷拷 openssl_seal() 锟斤拷

锟斤拷锟斤拷

sealed_data

open_data

锟斤拷锟斤拷锟斤拷贸晒锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫凤拷锟截打开碉拷锟斤拷锟捷★拷

env_key

priv_key_id

method

锟接斤拷锟斤拷锟姐法锟斤拷

iv

锟斤拷始锟斤拷锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
7.0.0 锟斤拷锟斤拷锟� iv 锟斤拷锟斤拷
5.3.0 锟斤拷锟斤拷锟� method 锟斤拷锟斤拷

锟斤拷锟斤拷

Example #1 openssl_open() 锟斤拷锟斤拷

<?php
// $sealed and $env_key are assumed to contain the sealed data
// and our envelope key, both given to us by the sealer.

// fetch private key from file and ready it
$fp fopen("/src/openssl-0.9.6/demos/sign/key.pem""r");
$priv_key fread($fp8192);
fclose($fp);
$pkeyid openssl_get_privatekey($priv_key);

// decrypt the data and store it in $open
if (openssl_open($sealed$open$env_key$pkeyid)) {
    echo 
"here is the opened data: "$open;
} else {
    echo 
"failed to open data";
}

// free the private key from memory
openssl_free_key($pkeyid);
?>

锟轿硷拷

  • openssl_seal() - 锟杰凤拷 (锟斤拷锟斤拷) 锟斤拷锟斤拷