summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-11-25 21:08:32 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-11-26 09:06:04 +0100
commit7ca0f29249eb11623c98efdc4fb6d0d7725ff10a (patch)
tree05677232e695942077029a214796ac64ff395733 /xmlsecurity
parent586bd08fa2655ad90ef4777626ad8f17d6a2c4ce (diff)
pdfium: replace PDFiumSignature::getPointer() with typed getters
Once reason and time has getters, no need to expose the underlying PDFium type. Change-Id: I8f6b152fddf38e76ad7c3b1897fcb2026129820f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106631 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/helper/pdfsignaturehelper.cxx28
1 files changed, 2 insertions, 26 deletions
diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index 062dba819adf..cbeba392a932 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -366,35 +366,11 @@ bool ValidateSignature(SvStream& rStream, const Signature& rSignature,
}
// Reason / comment / description is optional.
- int nReasonLen = FPDFSignatureObj_GetReason(rSignature.m_pSignature->getPointer(), nullptr, 0);
- if (nReasonLen > 0)
- {
- std::vector<char16_t> aReasonBuf(nReasonLen);
- FPDFSignatureObj_GetReason(rSignature.m_pSignature->getPointer(), aReasonBuf.data(),
- aReasonBuf.size());
- rInformation.ouDescription = OUString(aReasonBuf.data(), aReasonBuf.size() - 1);
- }
+ rInformation.ouDescription = rSignature.m_pSignature->getReason();
// Date: used only when the time of signing is not available in the
// signature.
- int nTimeLen = FPDFSignatureObj_GetTime(rSignature.m_pSignature->getPointer(), nullptr, 0);
- if (nTimeLen > 0)
- {
- // Example: "D:20161027100104".
- std::vector<char> aTimeBuf(nTimeLen);
- FPDFSignatureObj_GetTime(rSignature.m_pSignature->getPointer(), aTimeBuf.data(),
- aTimeBuf.size());
- OString aM(aTimeBuf.data(), aTimeBuf.size() - 1);
- if (aM.startsWith("D:") && aM.getLength() >= 16)
- {
- rInformation.stDateTime.Year = aM.copy(2, 4).toInt32();
- rInformation.stDateTime.Month = aM.copy(6, 2).toInt32();
- rInformation.stDateTime.Day = aM.copy(8, 2).toInt32();
- rInformation.stDateTime.Hours = aM.copy(10, 2).toInt32();
- rInformation.stDateTime.Minutes = aM.copy(12, 2).toInt32();
- rInformation.stDateTime.Seconds = aM.copy(14, 2).toInt32();
- }
- }
+ rInformation.stDateTime = rSignature.m_pSignature->getTime();
// Detect if the byte ranges don't cover everything, but the signature itself.
if (rSignature.m_aByteRanges.size() < 2)