diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2024-11-15 09:53:46 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-11-15 12:53:47 +0100 |
commit | 60261557e5311a7b445fb2455aa534697697a9ec (patch) | |
tree | 14646ab9c9b1b42b94f1a0a7e853cc05b2be4632 /svl | |
parent | c6fa60bdffe46ae869ae77c2cee14146a72808f6 (diff) |
cool#9992 lok doc sign: add initial serialization of external signatures
Now that the hash extract part works, the other end of this external
signature support is to be able to integrate an externally generated
(e.g. qualified) signature into our PDF file.
The problem is that we have SignDocumentContentUsingCertificate() for
non-interactive signing and we have the interactive sign dialog, but we
have no way to integrate an existing PKCS#7 blob.
Fix the problem by extending vcl::filter::PDFDocument::Sign(): if a
signature value is provided, then integrate that, instead of calling
svl::crypto::Signing::Sign() to generate a new signature.
Also extend the SigningContext documentation, since now it has 3 modes
(normal sign, hash extract, sign serialize).
Change-Id: I113fb536b1a83b8a4869a7064bb415bca6a91ae4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176623
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/crypto/cryptosign.cxx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx index a711a304c0fb..6a5f08077765 100644 --- a/svl/source/crypto/cryptosign.cxx +++ b/svl/source/crypto/cryptosign.cxx @@ -66,17 +66,6 @@ using namespace com::sun::star; namespace { - -#if USE_CRYPTO_ANY -void appendHex( sal_Int8 nInt, OStringBuffer& rBuffer ) -{ - static const char pHexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - rBuffer.append( pHexDigits[ (nInt >> 4) & 15 ] ); - rBuffer.append( pHexDigits[ nInt & 15 ] ); -} -#endif - #if USE_CRYPTO_NSS char *PDFSigningPKCS7PasswordCallback(PK11SlotInfo * /*slot*/, PRBool /*retry*/, void *arg) { @@ -2407,6 +2396,13 @@ bool Signing::Verify(SvStream& rStream, #endif } +void Signing::appendHex(sal_Int8 nInt, OStringBuffer& rBuffer) +{ + static const char pHexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + rBuffer.append( pHexDigits[ (nInt >> 4) & 15 ] ); + rBuffer.append( pHexDigits[ nInt & 15 ] ); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |