Commit 8e87dea7 authored by Volker Krause's avatar Volker Krause
Browse files

Fix VdvTicket::rawData()

This was returning the already decrypted content, which isn't what we need
to reproduce the corresponding barcodes.
parent d4a21b6e
......@@ -47,7 +47,7 @@ private Q_SLOTS:
{
auto data = QByteArray::fromHex("00f569d018f111d017d43b7d68003b8268008532da110000030000000002000992000000000000db0c000000000000000000000000dc0f1117d40000000004b000000000000018f110007a18f13b7974cfd400000017d48a00000105d601000105d602474200000000005644561400");
VdvTicket ticket(data);
VdvTicket ticket(data, {});
QCOMPARE(ticket.issuerId(), 6385);
QCOMPARE(ticket.beginDateTime(), QDateTime({2019, 11, 29}, {13, 0}));
QCOMPARE(ticket.endDateTime(), QDateTime({2019, 12, 2}, {13, 0}));
......@@ -56,7 +56,7 @@ private Q_SLOTS:
QCOMPARE(ticket.ticketNumber(), QStringLiteral("16083408"));
data = QByteArray::fromHex("001a4bab1874283e184434ba000134bb18008541da110001000000000003000000000000001a4bdb1502199610144B6174696523447261676F6E00000000dc150000000000000000000000000000000000000000001874110064187434b87128ff7a126918748a0000062e9e0100062e9e007d895644561107");
ticket = VdvTicket(data);
ticket = VdvTicket(data, {});
QCOMPARE(ticket.issuerId(), 6260);
QCOMPARE(ticket.beginDateTime(), QDateTime({2016, 5, 26}, {0, 0, 2}));
QCOMPARE(ticket.endDateTime(), QDateTime({2016, 5, 27}, {3, 0}));
......@@ -66,7 +66,7 @@ private Q_SLOTS:
QCOMPARE(ticket.ticketNumber(), QStringLiteral("1723307"));
data = QByteArray::fromHex("00f569d018f111d017d43b7d68003b8268008532da110000030000000000000992000000000000db0c00000000004B33654044346Edc0f1117d40000000004b000000000000018f110007a18f13b7974cfd400000017d48a00000105d601000105d602474200000000005644561400");
ticket = VdvTicket(data);
ticket = VdvTicket(data, {});
QCOMPARE(ticket.serviceClass(), VdvTicket::UnknownClass);
QCOMPARE(ticket.person().familyName(), QStringLiteral("D"));
QCOMPARE(ticket.person().givenName(), QStringLiteral("K"));
......
......@@ -20,6 +20,7 @@ class VdvTicketPrivate : public QSharedData
{
public:
QByteArray m_data;
QByteArray m_rawData;
BER::Element productElement(uint32_t type) const;
template <typename T> const T* productData(uint32_t type = T::Tag) const;
......@@ -50,7 +51,7 @@ VdvTicket::VdvTicket()
{
}
VdvTicket::VdvTicket(const QByteArray &data)
VdvTicket::VdvTicket(const QByteArray &data, const QByteArray &rawData)
: d(new VdvTicketPrivate)
{
if (data.size() < MinimumTicketDataSize) {
......@@ -86,6 +87,7 @@ VdvTicket::VdvTicket(const QByteArray &data)
return;
}
d->m_data = data;
d->m_rawData = rawData;
}
VdvTicket::VdvTicket(const VdvTicket&) = default;
......@@ -217,5 +219,5 @@ const VdvTicketTrailer* VdvTicket::trailer() const
QByteArray VdvTicket::rawData() const
{
return d->m_data;
return d->m_rawData;
}
......@@ -46,7 +46,7 @@ class KITINERARY_EXPORT VdvTicket
public:
VdvTicket();
VdvTicket(const QByteArray &data);
VdvTicket(const QByteArray &data, const QByteArray &rawData);
VdvTicket(const VdvTicket&);
~VdvTicket();
VdvTicket& operator=(const VdvTicket&);
......
......@@ -74,7 +74,7 @@ bool VdvTicketParser::parse(const QByteArray &data)
decoder.add(sigRemainder.contentData(), sigRemainder.contentSize());
// (4) profit!
m_ticket = VdvTicket(decoder.recoveredMessage());
m_ticket = VdvTicket(decoder.recoveredMessage(), data);
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment