1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-12 17:17:26 +01:00

Allow to specify extension value as critical

This commit is contained in:
Bastien Miclo 2021-04-13 23:18:26 +02:00 committed by terrafrost
parent 8123521307
commit 0dabb0c090
4 changed files with 9 additions and 7 deletions

View File

@ -47,7 +47,7 @@ class PrivateKey extends DH
* Returns the public key * Returns the public key
* *
* @access public * @access public
* @return DH * @return DH\PublicKey
*/ */
public function getPublicKey() public function getPublicKey()
{ {

View File

@ -670,10 +670,11 @@ class X509
*/ */
private function mapOutExtensions(&$root, $path) private function mapOutExtensions(&$root, $path)
{ {
foreach ($this->extensionValues as $id => $value) { foreach ($this->extensionValues as $id => [$critical, $value]) {
$root['tbsCertificate']['extensions'][] = [ $root['tbsCertificate']['extensions'][] = [
'extnId' => $id, 'extnId' => $id,
'extnValue' => $value, 'extnValue' => $value,
'critical' => $critical,
]; ];
} }
@ -4079,9 +4080,10 @@ class X509
* *
* @param string $id * @param string $id
* @param mixed $value * @param mixed $value
* @param bool $critical
*/ */
public function setExtensionValue($id, $value) public function setExtensionValue($id, $value, $critical = false)
{ {
$this->extensionValues[$id] = $value; $this->extensionValues[$id] = [$critical, $value];
} }
} }