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