at($idx++) ->asEnumerated() ->intNumber(); if ($seq->has($idx, Element::TYPE_OBJECT_IDENTIFIER)) { $oid = $seq->at($idx++) ->asObjectIdentifier() ->oid(); } $algo = AlgorithmIdentifier::fromASN1($seq->at($idx++)->asSequence()); $digest = $seq->at($idx) ->asBitString(); return self::create($type, $algo, $digest, $oid); } /** * Generate ASN.1 structure. */ public function toASN1(): Sequence { $elements = [Enumerated::create($this->digestedObjectType)]; if (isset($this->otherObjectTypeID)) { $elements[] = ObjectIdentifier::create($this->otherObjectTypeID); } $elements[] = $this->digestAlgorithm->toASN1(); $elements[] = $this->objectDigest; return Sequence::create(...$elements); } }