@@ 69-94 (lines=26) @@ | ||
66 | * |
|
67 | * @param Sequence $seq |
|
68 | */ |
|
69 | public static function fromASN1(Sequence $seq) { |
|
70 | $cert_id = null; |
|
71 | $entity_name = null; |
|
72 | $digest_info = null; |
|
73 | if ($seq->hasTagged(0)) { |
|
74 | $cert_id = IssuerSerial::fromASN1( |
|
75 | $seq->getTagged(0) |
|
76 | ->asImplicit(Element::TYPE_SEQUENCE) |
|
77 | ->asSequence()); |
|
78 | } |
|
79 | if ($seq->hasTagged(1)) { |
|
80 | $entity_name = GeneralNames::fromASN1( |
|
81 | $seq->getTagged(1) |
|
82 | ->asImplicit(Element::TYPE_SEQUENCE) |
|
83 | ->asSequence()); |
|
84 | } |
|
85 | if ($seq->hasTagged(2)) { |
|
86 | $digest_info = ObjectDigestInfo::fromASN1( |
|
87 | $seq->getTagged(2) |
|
88 | ->asImplicit(Element::TYPE_SEQUENCE) |
|
89 | ->asSequence()); |
|
90 | } |
|
91 | $obj = new self($cert_id, $entity_name); |
|
92 | $obj->_objectDigestInfo = $digest_info; |
|
93 | return $obj; |
|
94 | } |
|
95 | ||
96 | /** |
|
97 | * Get self with base certificate ID. |
@@ 58-81 (lines=24) @@ | ||
55 | * @param Sequence $seq |
|
56 | * @return self |
|
57 | */ |
|
58 | public static function fromV2ASN1(Sequence $seq) { |
|
59 | $issuer = null; |
|
60 | $cert_id = null; |
|
61 | $digest_info = null; |
|
62 | if ($seq->has(0, Element::TYPE_SEQUENCE)) { |
|
63 | $issuer = GeneralNames::fromASN1($seq->at(0)->asSequence()); |
|
64 | } |
|
65 | if ($seq->hasTagged(0)) { |
|
66 | $cert_id = IssuerSerial::fromASN1( |
|
67 | $seq->getTagged(0) |
|
68 | ->asImplicit(Element::TYPE_SEQUENCE) |
|
69 | ->asSequence()); |
|
70 | } |
|
71 | if ($seq->hasTagged(1)) { |
|
72 | $digest_info = ObjectDigestInfo::fromASN1( |
|
73 | $seq->getTagged(1) |
|
74 | ->asImplicit(Element::TYPE_SEQUENCE) |
|
75 | ->asSequence()); |
|
76 | } |
|
77 | $obj = new self($issuer); |
|
78 | $obj->_baseCertificateID = $cert_id; |
|
79 | $obj->_objectDigestInfo = $digest_info; |
|
80 | return $obj; |
|
81 | } |
|
82 | ||
83 | /** |
|
84 | * Check whether issuer name is set. |