public function testContent() { $oid = OID::COMMON_NAME; $string = 'Friedrich Große'; $object = new RelativeDistinguishedName($oid, new UTF8String($string)); $this->assertEquals(OID::getName($oid) . ": {$string}", $object->getContent()); }
public static function fromBinary(&$binaryData, &$offsetIndex = 0) { self::parseIdentifier($binaryData[$offsetIndex], Identifier::SEQUENCE, $offsetIndex++); $contentLength = self::parseContentLength($binaryData, $offsetIndex); $names = []; $octetsToRead = $contentLength; while ($octetsToRead > 0) { $relativeDistinguishedName = RelativeDistinguishedName::fromBinary($binaryData, $offsetIndex); $octetsToRead -= $relativeDistinguishedName->getObjectLength(); $names[] = $relativeDistinguishedName; } }
/** * @param string|\FG\ASN1\Universal\ObjectIdentifier $objectIdentifierString * @param string|\FG\ASN1\Object $value */ public function __construct($objectIdentifierString, $value) { if (PrintableString::isValid($value)) { $value = new PrintableString($value); } else { if (IA5String::isValid($value)) { $value = new IA5String($value); } else { $value = new UTF8String($value); } } parent::__construct($objectIdentifierString, $value); }