As a note, the docs don't show the (optional) second parameter nor mention the existence of the Phar::OPENSSL class constant also available for use with this method.
To sign a phar with OpenSSL, for example...
<?php
$phar = new Phar('somephar.phar');
// ... add your files and such
$phar->setSignatureAlgorithm(Phar::OPENSSL, file_get_contents('private_key_here.pem'));
// ... do whatever else you want afterwards here ...
?>
Hope this proves useful to someone.PharData::setSignatureAlgorithm
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
PharData::setSignatureAlgorithm
Референца за `phardata.setsignaturealgorithm.php` со подобрена типографија и навигација.
PharData::setSignatureAlgorithm
(Нема достапни информации за верзијата, можеби е само во Git)
PharData::setSignatureAlgorithm — Set the signature algorithm for a phar and apply it
= NULL
Забелешка:
Се користи за поставување на PHP лоадерот или bootstrap stub на Phar архивата на стандарден лоадер php.ini setting
phar.readonlyОвој метод бара0да биде поставено на за да работи за Phar PharException ќе биде фрлена.
Set the signature algorithm for a phar and apply it. The signature algorithm must be one of Phar::MD5,
Phar::SHA1, Phar::SHA256,
Phar::SHA512, или Phar::OPENSSL.
Параметри
algo-
Еден од
Phar::MD5,Phar::SHA1,Phar::SHA256,Phar::SHA512, илиPhar::OPENSSL
Вратени вредности
Не се враќа вредност.
Errors/Exceptions
). Ако повикот не успее, ќе врати UnexpectedValueException for many errors, BadMethodCallException if called for a zip- or a tar-based phar archive, and a PharException if any problems occur flushing changes to disk.
Дневник на промени
| Верзија | = NULL |
|---|---|
| 8.0.0 |
privateKey сега е null.
|
Види Исто така
- Phar::getSupportedSignatures() - Врати низа од поддржани типови на потписи
- Phar::getSignature() - Врати MD5/SHA1/SHA256/SHA512/OpenSSL потпис на Phar архива