diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-10-20 08:44:43 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-10-20 09:00:44 +0000 |
commit | 4c76fd79b73eb365917e7684a6540053186fe182 (patch) | |
tree | 81ffa4359eacb750b03442dc857d0ac57632b408 /include | |
parent | e9ada6294d08983c30e043dc79e441cafa92257c (diff) |
Extract vcl::PDFWriter::Sign() from vcl and xmlsecurity
The use case is different in vcl and xmlsecurity: vcl creates a new PDF
(possibly with a signature), while xmlsecurity signs an existing PDF,
but this part can be shared between the two.
So far in vcl only the nss part is moved, not touching mscrypto yet.
Change-Id: Ie776f622c1a4a3a18e79e78f68722a2fa219a83b
Reviewed-on: https://gerrit.libreoffice.org/30063
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/pdfwriter.hxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 6b0da676108c..6b9c52920a53 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -23,6 +23,7 @@ #include <tools/gen.hxx> #include <tools/color.hxx> +#include <rtl/strbuf.hxx> #include <vcl/dllapi.h> #include <vcl/vclenum.hxx> @@ -546,6 +547,29 @@ The following structure describes the permissions used in PDF security DrawColor, DrawGreyscale }; + /// Holds all information to be able to fill a PDF signature template. + struct VCL_DLLPUBLIC PDFSignContext + { + /// DER-encoded certificate buffer. + sal_Int8* m_pDerEncoded; + /// Length of m_pDerEncoded. + sal_Int32 m_nDerEncoded; + /// Bytes before the signature itself. + void* m_pByteRange1; + /// Length of m_pByteRange1. + sal_Int32 m_nByteRange1; + /// Bytes after the signature itself. + void* m_pByteRange2; + /// Length of m_pByteRange2. + sal_Int32 m_nByteRange2; + OUString m_aSignTSA; + OUString m_aSignPassword; + /// The signature (in PKCS#7 format) is written into this buffer. + OStringBuffer& m_rCMSHexBuffer; + + PDFSignContext(OStringBuffer& rCMSHexBuffer); + }; + struct PDFWriterContext { /* must be a valid file: URL usable by osl */ @@ -1241,6 +1265,8 @@ The following structure describes the permissions used in PDF security */ void AddStream( const OUString& rMimeType, PDFOutputStream* pStream ); + /// Fill a PDF signature template. + static bool Sign(PDFSignContext& rContext); }; } |