diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-09-10 11:41:29 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-09-10 11:42:50 +0200 |
commit | d572ab1bb446e880fcb8d27294ba8149550f1659 (patch) | |
tree | d29c449b551e47569c6d9f146ba9e86810c05353 /src/network/ssl/qasn1element_p.h | |
parent | 211cef46f6d9d8738c09f906f9c0c3080b445dc8 (diff) | |
parent | 71df09b6cca7cd7a673bf39f49d0dda28b78a860 (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: Id4997327cc01bd4bb397a463bdffbd15e80398ef
Diffstat (limited to 'src/network/ssl/qasn1element_p.h')
-rw-r--r-- | src/network/ssl/qasn1element_p.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/network/ssl/qasn1element_p.h b/src/network/ssl/qasn1element_p.h index 6b3179ac35..36a7c90de3 100644 --- a/src/network/ssl/qasn1element_p.h +++ b/src/network/ssl/qasn1element_p.h @@ -59,11 +59,15 @@ QT_BEGIN_NAMESPACE +#define RSA_ENCRYPTION_OID QByteArrayLiteral("1.2.840.113549.1.1.1") +#define DSA_ENCRYPTION_OID QByteArrayLiteral("1.2.840.10040.4.1") + class Q_AUTOTEST_EXPORT QAsn1Element { public: enum ElementType { // universal + BooleanType = 0x01, IntegerType = 0x02, BitStringType = 0x03, OctetStringType = 0x04, @@ -77,10 +81,6 @@ public: SequenceType = 0x30, SetType = 0x31, - // application - Rfc822NameType = 0x81, - DnsNameType = 0x82, - // context specific Context0Type = 0xA0, Context3Type = 0xA3 @@ -91,12 +91,15 @@ public: bool read(const QByteArray &data); void write(QDataStream &data) const; + static QAsn1Element fromBool(bool val); static QAsn1Element fromInteger(unsigned int val); static QAsn1Element fromVector(const QVector<QAsn1Element> &items); static QAsn1Element fromObjectId(const QByteArray &id); + bool toBool(bool *ok = 0) const; QDateTime toDateTime() const; QMultiMap<QByteArray, QString> toInfo() const; + qint64 toInteger(bool *ok = 0) const; QVector<QAsn1Element> toVector() const; QByteArray toObjectId() const; QByteArray toObjectName() const; @@ -105,12 +108,21 @@ public: quint8 type() const { return mType; } QByteArray value() const { return mValue; } + friend inline bool operator==(const QAsn1Element &, const QAsn1Element &); + friend inline bool operator!=(const QAsn1Element &, const QAsn1Element &); + private: quint8 mType; QByteArray mValue; }; Q_DECLARE_TYPEINFO(QAsn1Element, Q_MOVABLE_TYPE); +inline bool operator==(const QAsn1Element &e1, const QAsn1Element &e2) +{ return e1.mType == e2.mType && e1.mValue == e2.mValue; } + +inline bool operator!=(const QAsn1Element &e1, const QAsn1Element &e2) +{ return e1.mType != e2.mType || e1.mValue != e2.mValue; } + QT_END_NAMESPACE #endif |