summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-06-23 10:18:01 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-06-23 12:36:10 +0200
commit91ffe409e35479d024f629fe1b5ce474993a0f54 (patch)
tree907f5203504fe0e4c8dc5dd11e4b4d58b9c0ae44 /xmlsecurity
parent7add9c24af8ea965f0411d4b852491af337822df (diff)
tdf#108692 gpg4libre: List all gpg keys
Change-Id: I7300da36215233fa91b7a04a42b1c9bf907ad78b
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;