at(0) ->asInteger() ->number(); $s = $seq->at(1) ->asInteger() ->number(); return self::create($r, $s); } /** * Initialize from DER. */ public static function fromDER(string $data): self { return self::fromASN1(UnspecifiedType::fromDER($data)->asSequence()); } /** * Get the r-value. * * @return string Base 10 integer string */ public function r(): string { return $this->r; } /** * Get the s-value. * * @return string Base 10 integer string */ public function s(): string { return $this->s; } /** * Generate ASN.1 structure. */ public function toASN1(): Sequence { return Sequence::create(Integer::create($this->r), Integer::create($this->s)); } /** * Get DER encoding of the signature. */ public function toDER(): string { return $this->toASN1() ->toDER(); } public function bitString(): BitString { return BitString::create($this->toDER()); } }