summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-06-23 10:18:01 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-06-28 10:11:17 +0200
commit40c2e584df0cbef84d21c03ca889078a3b093a0f (patch)
tree6e12c2d79110f2957bc0f37ce07d7a414e4a3cc9 /xmlsecurity
parent8b9f00fced21014bed6695b962084c8af0249dbc (diff)
tdf#108692 gpg4libre: List all gpg keys
Change-Id: I7300da36215233fa91b7a04a42b1c9bf907ad78b (cherry picked from commit 91ffe409e35479d024f629fe1b5ce474993a0f54) Reviewed-on: https://gerrit.libreoffice.org/39163 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/gpg/SecurityEnvironment.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
index 9892ec6ac5c8..bc7611fa7968 100644
--- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx
+++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
@@ -65,6 +65,7 @@ OUString SecurityEnvironmentGpg::getSecurityEnvironmentInformation()
Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::getPersonalCertificates()
{
CertificateImpl* xCert;
+ std::list< GpgME::Key > keyList;
std::list< CertificateImpl* > certsList;
m_ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL);
@@ -74,13 +75,19 @@ Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::getPersonalCertif
if (err)
break;
if (!k.isInvalid()) {
- xCert = new CertificateImpl();
- xCert->setCertificate(m_ctx.get(),k);
- certsList.push_back(xCert);
+ // We can't create CertificateImpl here as CertificateImpl::setCertificate uses GpgME API
+ // which interrupts our key listing here. So first get the keys from GpgME, then create the CertificateImpls
+ keyList.push_back(k);
}
}
m_ctx->endKeyListing();
+ for (auto const& key : keyList) {
+ xCert = new CertificateImpl();
+ xCert->setCertificate(m_ctx.get(),key);
+ certsList.push_back(xCert);
+ }
+
Sequence< Reference< XCertificate > > xCertificateSequence(certsList.size());
std::list< CertificateImpl* >::iterator xcertIt;
int i;