Description
bool 
openssl_sign ( string data, string signature, mixed priv_key_id)
| 警告 | 
本扩展模块是实验性的。该模块的行为,包括其函数的名称以及其它任何关于此模块的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。我们提醒您在使用本扩展模块的同时自担风险。
  | 
     如果成功则返回 TRUE,失败则返回 FALSE。
     If successful the signature is returned in
     signature. 
    
     openssl_sign() computes a signature for the
     specified data by using SHA1 for hashing
     followed by encryption using the private key associated with
     priv_key_id. Note that the data itself is
     not encrypted.
    
     
例子 1. openssl_sign() example 
<?php // $data is assumed to contain the data to be signed
  // fetch private key from file and ready it $fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r"); $priv_key = fread($fp, 8192); fclose($fp); $pkeyid = openssl_get_privatekey($priv_key);
  // compute signature openssl_sign($data, $signature, $pkeyid);
  // free the key from memory openssl_free_key($pkeyid); ?>
 |  
  | 
    
     See also openssl_verify().