П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 3439 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 5995 раз(а).

Учебник HTML.
Просмотров 3220 раз(а).

Руководство по PHP5.
Просмотров 5442 раз(а).

Хостинг через призму DNS.
Просмотров 4050 раз(а).

Подборка текстов стандартных документов.
Просмотров 55723 раз(а).

Учебник PHP - Самоучитель
Просмотров 3021 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 4814 раз(а).

Внешние атаки...
Просмотров 3759 раз(а).

Учебник PHP.
Просмотров 2782 раз(а).

SSI в примерах.
Просмотров 37396 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. След.

openssl_pkcs7_sign

(PHP 4 >= 4.0.6, PHP 5)

openssl_pkcs7_sign -- Sign an S/MIME message

Description

bool openssl_pkcs7_sign ( string infilename, string outfilename, mixed signcert, mixed privkey, array headers [, int flags [, string extracerts]] )

openssl_pkcs7_sign() takes the contents of the file named infilename and signs them using the certificate and its matching private key specified by signcert and privkey parameters.

headers is an array of headers that will be prepended to the data after it has been signed (see openssl_pkcs7_encrypt() for more information about the format of this parameter.

flags can be used to alter the output - see PKCS7 constants - if not specified, it defaults to PKCS7_DETACHED.

extracerts specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used.

Пример 1. openssl_pkcs7_sign() example

<?php
// the message you want to sign so that recipient can be sure it was you that
// sent it
$data = <<<EOD

You have my authorization to spend
$10,000 on dinner expenses.

The CEO
EOD;
// save message to file
$fp = fopen("msg.txt", "w");
fwrite($fp, $data);
fclose($fp);
// encrypt it
if (openssl_pkcs7_sign("msg.txt", "signed.txt", "mycert.pem",
    array(
"file://mycert.pem", "mypassphrase"),
    array(
"To" => "joes@example.com", // keyed syntax
          
"From: HQ <ceo@example.com>", // indexed syntax
          
"Subject" => "Eyes only")
    )) {
    
// message signed - send it!
    
exec(ini_get("sendmail_path") . " < signed.txt");
}
?>


Пред. Начало След.
openssl_pkcs7_encrypt Уровень выше openssl_pkcs7_verify


Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru