| @@ 62-71 (lines=10) @@ | ||
| 59 | * @param Sequence $seq |
|
| 60 | * @return self |
|
| 61 | */ |
|
| 62 | public static function fromASN1(Sequence $seq) { |
|
| 63 | $acinfo = AttributeCertificateInfo::fromASN1($seq->at(0)->asSequence()); |
|
| 64 | $algo = AlgorithmIdentifier::fromASN1($seq->at(1)->asSequence()); |
|
| 65 | if (!$algo instanceof SignatureAlgorithmIdentifier) { |
|
| 66 | throw new \UnexpectedValueException( |
|
| 67 | "Unsupported signature algorithm " . $algo->oid() . "."); |
|
| 68 | } |
|
| 69 | $signature = Signature::fromASN1($seq->at(2)->asBitString()); |
|
| 70 | return new self($acinfo, $algo, $signature); |
|
| 71 | } |
|
| 72 | ||
| 73 | /** |
|
| 74 | * Initialize from DER data. |
|
| @@ 63-72 (lines=10) @@ | ||
| 60 | * @param Sequence $seq |
|
| 61 | * @return self |
|
| 62 | */ |
|
| 63 | public static function fromASN1(Sequence $seq) { |
|
| 64 | $tbsCert = TBSCertificate::fromASN1($seq->at(0)->asSequence()); |
|
| 65 | $algo = AlgorithmIdentifier::fromASN1($seq->at(1)->asSequence()); |
|
| 66 | if (!$algo instanceof SignatureAlgorithmIdentifier) { |
|
| 67 | throw new \UnexpectedValueException( |
|
| 68 | "Unsupported signature algorithm " . $algo->oid() . "."); |
|
| 69 | } |
|
| 70 | $signature = Signature::fromASN1($seq->at(2)->asBitString()); |
|
| 71 | return new self($tbsCert, $algo, $signature); |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * Initialize from DER. |
|