summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2014-09-02 09:34:11 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2014-09-02 09:52:08 +0200
commit31938846aec24970e4a53771db201a7f0ac9ac3a (patch)
treecffadcc57ac270c2815f399369b80a05ebb93a16 /tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp
parentb366d0d0166bbb114ccf9a8e8be7d3c6c45e313e (diff)
qasn1element: add QAsn1Element::toInteger
This change adds the ability to decode ASN.1 INTEGER fields, provided they represent a positive number of less than 64-bit. This is needed for PKCS#12 decoding. Change-Id: Iafb76f22383278d6773b9e879a8f3ef43c8d2c8f Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp')
-rw-r--r--tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp b/tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp
index 661d13bc69..5fb4c28282 100644
--- a/tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp
+++ b/tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp
@@ -122,6 +122,14 @@ void tst_QAsn1Element::integer()
QFETCH(QByteArray, encoded);
QFETCH(int, value);
+ // read
+ bool ok;
+ QAsn1Element elem;
+ QVERIFY(elem.read(encoded));
+ QCOMPARE(elem.type(), quint8(QAsn1Element::IntegerType));
+ QCOMPARE(elem.toInteger(&ok), value);
+ QVERIFY(ok);
+
// write
QByteArray buffer;
QDataStream stream(&buffer, QIODevice::WriteOnly);