isPrimitive()) { throw new DecodeException('DER encoded string must be primitive.'); } $length = Length::expectFromDER($data, $idx)->intLength(); $str = $length === 0 ? '' : mb_substr($data, $idx, $length, '8bit'); $offset = $idx + $length; try { return static::create($str); } catch (InvalidArgumentException $e) { throw new DecodeException($e->getMessage(), 0, $e); } } }