lib/X509/Certificate/Extension/CRLDistributionPointsExtension.php 1 location
|
@@ 37-49 (lines=13) @@
|
| 34 |
|
$this->_distributionPoints = $distribution_points; |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
protected static function _fromDER($data, $critical) { |
| 38 |
|
$dps = array_map( |
| 39 |
|
function (UnspecifiedType $el) { |
| 40 |
|
return DistributionPoint::fromASN1($el->asSequence()); |
| 41 |
|
}, Sequence::fromDER($data)->elements()); |
| 42 |
|
if (!count($dps)) { |
| 43 |
|
throw new \UnexpectedValueException( |
| 44 |
|
"CRLDistributionPoints must have" . |
| 45 |
|
" at least one DistributionPoint."); |
| 46 |
|
} |
| 47 |
|
// late static bound, extended by Freshest CRL extension |
| 48 |
|
return new static($critical, ...$dps); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
protected function _valueASN1() { |
| 52 |
|
if (!count($this->_distributionPoints)) { |
lib/X509/Certificate/Extension/NameConstraints/GeneralSubtrees.php 1 location
|
@@ 39-49 (lines=11) @@
|
| 36 |
|
* @param Sequence $seq |
| 37 |
|
* @return self |
| 38 |
|
*/ |
| 39 |
|
public static function fromASN1(Sequence $seq) { |
| 40 |
|
$subtrees = array_map( |
| 41 |
|
function (UnspecifiedType $el) { |
| 42 |
|
return GeneralSubtree::fromASN1($el->asSequence()); |
| 43 |
|
}, $seq->elements()); |
| 44 |
|
if (!count($subtrees)) { |
| 45 |
|
throw new \UnexpectedValueException( |
| 46 |
|
"GeneralSubtrees must contain at least one GeneralSubtree."); |
| 47 |
|
} |
| 48 |
|
return new self(...$subtrees); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
/** |
| 52 |
|
* Get all subtrees. |
lib/X509/Certificate/Extension/SubjectDirectoryAttributesExtension.php 1 location
|
@@ 32-42 (lines=11) @@
|
| 29 |
|
$this->_attributes = $attribs; |
| 30 |
|
} |
| 31 |
|
|
| 32 |
|
protected static function _fromDER($data, $critical) { |
| 33 |
|
$attribs = array_map( |
| 34 |
|
function (UnspecifiedType $el) { |
| 35 |
|
return Attribute::fromASN1($el->asSequence()); |
| 36 |
|
}, Sequence::fromDER($data)->elements()); |
| 37 |
|
if (!count($attribs)) { |
| 38 |
|
throw new \UnexpectedValueException( |
| 39 |
|
"SubjectDirectoryAttributes must have at least one Attribute."); |
| 40 |
|
} |
| 41 |
|
return new self($critical, ...$attribs); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
protected function _valueASN1() { |
| 45 |
|
if (!count($this->_attributes)) { |
lib/X509/GeneralName/GeneralNames.php 1 location
|
@@ 44-54 (lines=11) @@
|
| 41 |
|
* @throws \UnexpectedValueException |
| 42 |
|
* @return self |
| 43 |
|
*/ |
| 44 |
|
public static function fromASN1(Sequence $seq) { |
| 45 |
|
if (!count($seq)) { |
| 46 |
|
throw new \UnexpectedValueException( |
| 47 |
|
"GeneralNames must have at least one GeneralName."); |
| 48 |
|
} |
| 49 |
|
$names = array_map( |
| 50 |
|
function (UnspecifiedType $el) { |
| 51 |
|
return GeneralName::fromASN1($el->asTagged()); |
| 52 |
|
}, $seq->elements()); |
| 53 |
|
return new self(...$names); |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
/** |
| 57 |
|
* Find first GeneralName by given tag. |
lib/X509/Certificate/Extension/CertificatePoliciesExtension.php 1 location
|
@@ 40-51 (lines=12) @@
|
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
protected static function _fromDER($data, $critical) { |
| 41 |
|
$policies = array_map( |
| 42 |
|
function (UnspecifiedType $el) { |
| 43 |
|
return PolicyInformation::fromASN1($el->asSequence()); |
| 44 |
|
}, Sequence::fromDER($data)->elements()); |
| 45 |
|
if (!count($policies)) { |
| 46 |
|
throw new \UnexpectedValueException( |
| 47 |
|
"certificatePolicies must contain" . |
| 48 |
|
" at least one PolicyInformation."); |
| 49 |
|
} |
| 50 |
|
return new self($critical, ...$policies); |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
/** |
| 54 |
|
* Check whether policy information by OID is present. |
lib/X509/Certificate/Extension/PolicyMappingsExtension.php 1 location
|
@@ 38-48 (lines=11) @@
|
| 35 |
|
$this->_mappings = $mappings; |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
protected static function _fromDER($data, $critical) { |
| 39 |
|
$mappings = array_map( |
| 40 |
|
function (UnspecifiedType $el) { |
| 41 |
|
return PolicyMapping::fromASN1($el->asSequence()); |
| 42 |
|
}, Sequence::fromDER($data)->elements()); |
| 43 |
|
if (!count($mappings)) { |
| 44 |
|
throw new \UnexpectedValueException( |
| 45 |
|
"PolicyMappings must have at least one mapping."); |
| 46 |
|
} |
| 47 |
|
return new self($critical, ...$mappings); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
protected function _valueASN1() { |
| 51 |
|
if (!count($this->_mappings)) { |