* IssuerAndSerialNumber :: = SEQUENCE { * issuer Name, * serialNumber CertificateSerialNumber * } * * *
* CertificateSerialNumber :: = INTEGER ** * @package asn1 * @subpackage cms * * @link http://tools.ietf.org/html/rfc3852#section-10.2.4 RFC 3852: Cryptographic Message Syntax */ class CMSIssuerAndSerialNumber implements ASN1DEREncodable { private $issuer; private $serialNumber; /** * Constructs a new instance of CMSIssuerAndSerialNumber. */ public function __construct() { } /** * Decodes the given ASN1Sequence as CMSIssuerAndSerialNumber. * * @throws GTException * @param ASN1Sequence $object CMSIssuerAndSerialNumber encoded as an ASN1Sequence. * @return void */ public function decode($object) { if (!$object instanceof ASN1Sequence) { throw new GTException("Expecting an ASN1Sequence"); } $size = $object->getObjectCount(); if ($size != 2) { throw new GTException("Invalid sequence size: {$size}"); } $issuer = $object->getObjectAt(0); if (!$issuer instanceof ASN1Sequence) { throw new GTException("Expecting an ASN1Sequence"); } if ($issuer->getObjectCount() == 0) { throw new GTException("Issuer content missing"); } $this->issuer = $issuer; $serialNumber = $object->getObjectAt(1); if (!$serialNumber instanceof ASN1Integer) { throw new GTException("Expecting an ASN1Integer"); } $this->serialNumber = $serialNumber->getValue(); } /** * Encodes this CMSIssuerAndSerialNumber using DER. * * @return array byte array that contains the DER encoding of this CMSIssuerAndSerialNumber */ public function encodeDER() { $sequence = new ASN1Sequence(); $sequence->add($this->issuer); $sequence->add(new ASN1Integer(new GTBigInteger($this->serialNumber))); return $sequence->encodeDER(); } /** * Gets the issuer. * * @return ASN1Sequence unparsed issuer as ASN1Sequence */ public function getIssuer() { return $this->issuer; } /** * Sets the issuer. * * @param ASN1Sequence $issuer unparsed issuer as ASN1Sequence * @return void */ public function setIssuer($issuer) { $this->issuer = $issuer; } /** * Gets the serial number. * * @return string serial number */ public function getSerialNumber() { return $this->serialNumber; } /** * Sets the serial number. * * @param string $serialNumber the serial number * @return void */ public function setSerialNumber($serialNumber) { $this->serialNumber = $serialNumber; } } ?>