private function _parseAttrTypeAndValue(int &$offset): array
    {
        $idx = $offset;
        $type = $this->_parseAttrType($idx);
        $this->_skipWs($idx);
        if ($idx >= $this->_len || "=" != $this->_dn[$idx++]) {
            throw new \UnexpectedValueException("Invalid type and value pair.");
        }
        $this->_skipWs($idx);
        // hexstring
        if ($idx < $this->_len && "#" == $this->_dn[$idx]) {
            ++$idx;
            $data = $this->_parseAttrHexValue($idx);
            try {
                $value = Element::fromDER($data);
            } catch (DecodeException $e) {
                throw new \UnexpectedValueException(
                    "Invalid DER encoding from hexstring.", 0, $e);
            }
        } else {
            $value = $this->_parseAttrStringValue($idx);
        }
        $offset = $idx;
        return array($type, $value);
    }