public function testGetBinary()
 {
     $object = new CertificateExtensions();
     $objectIdentifier = new ObjectIdentifier(OID::CERT_EXT_SUBJECT_ALT_NAME);
     $sans = new SubjectAlternativeNames();
     $sans->addDomainName(new DNSName('corvespace.de'));
     $object->addSubjectAlternativeNames($sans);
     $expectedType = chr(Identifier::SET);
     $expectedLength = chr(2 + 2 + $objectIdentifier->getObjectLength() + $sans->getObjectLength());
     $expectedContent = chr(Identifier::SEQUENCE);
     $expectedContent .= chr(2 + $objectIdentifier->getObjectLength() + $sans->getObjectLength());
     $expectedContent .= chr(Identifier::SEQUENCE);
     $expectedContent .= chr($objectIdentifier->getObjectLength() + $sans->getObjectLength());
     $expectedContent .= $objectIdentifier->getBinary();
     $expectedContent .= $sans->getBinary();
     $this->assertEquals($expectedType . $expectedLength . $expectedContent, $object->getBinary());
 }
 /**
  * @depends testFromBinary
  */
 public function testFromBinaryWithOffset()
 {
     $originalObject1 = new ObjectIdentifier('1.2.3');
     $originalObject2 = new ObjectIdentifier('1.2.250.1.16.9');
     $binaryData = $originalObject1->getBinary();
     $binaryData .= $originalObject2->getBinary();
     $offset = 0;
     $parsedObject = ObjectIdentifier::fromBinary($binaryData, $offset);
     $this->assertEquals($originalObject1, $parsedObject);
     $this->assertEquals(4, $offset);
     $parsedObject = ObjectIdentifier::fromBinary($binaryData, $offset);
     $this->assertEquals($originalObject2, $parsedObject);
     $this->assertEquals(12, $offset);
 }