[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - xmlsecurity/source
Thorsten Behrens
Thorsten.Behrens at CIB.de
Tue Jun 27 14:42:24 UTC 2017
xmlsecurity/source/gpg/CertificateImpl.cxx | 6 +++++-
xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx | 2 ++
2 files changed, 7 insertions(+), 1 deletion(-)
New commits:
commit 8a4c085d69019d9a7f9d632149fd87adfa7df4e6
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date: Sat Jun 24 00:50:31 2017 +0200
gpg4libre: save some space, extract binary key/sign data
Since callers will base64-encode this anyway, again
Reviewed-on: https://gerrit.libreoffice.org/39193
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
(cherry picked from commit 72e7cfd776dee2edfa513f8f1a8f45136de1d8ba)
Change-Id: I0962d102fa0f2b95eaa2e608539cc291125f0321
Reviewed-on: https://gerrit.libreoffice.org/39237
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx
index e40f59323a04..20fa35c52d5d 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.cxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.cxx
@@ -211,7 +211,11 @@ void CertificateImpl::setCertificate(GpgME::Context* ctx, const GpgME::Key& key)
// extract key data, store into m_aBits
GpgME::Data data_out;
- ctx->exportPublicKeys(key.keyID(), data_out);
+ ctx->setArmor(false); // caller will base64-encode anyway
+ GpgME::Error err = ctx->exportPublicKeys(key.keyID(), data_out);
+
+ if (err)
+ throw RuntimeException("The GpgME library failed to retrieve the public key");
assert(data_out.seek(0,SEEK_SET) == 0);
int len=0, curr=0; char buf;
diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
index a1c2b8fb7cf3..902adaf7e9f8 100644
--- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
+++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
@@ -207,6 +207,8 @@ SAL_CALL XMLSignature_GpgImpl::generate(
SAL_INFO("xmlsecurity.xmlsec.gpg", "Generating signature for: " << xmlSecBufferGetData(pDsigCtx->transformCtx.result));
+ // we base64-encode anyway
+ rCtx.setArmor(false);
GpgME::SigningResult sign_res=rCtx.sign(data_in, data_out,
GpgME::Detached);
assert(data_out.seek(0,SEEK_SET) == 0);
More information about the Libreoffice-commits
mailing list