Kaydet (Commit) 91ffe409 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

tdf#108692 gpg4libre: List all gpg keys

Change-Id: I7300da36215233fa91b7a04a42b1c9bf907ad78b
üst 7add9c24
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment