diff options
author | Gabor Kelemen <kelemen.gabor2@nisz.hu> | 2020-04-22 10:25:57 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-04-29 07:05:36 +0200 |
commit | bedba76adb9b1421a7d939cfef44b8194e987888 (patch) | |
tree | e7a6925910d17e62c9ed7814b59dd6f98d86e7e9 /xmlsecurity | |
parent | 14fef320301f71f68547af1c0527677cc0ef6f88 (diff) |
tdf#131733 Show only CN part of X.509 subject info
The problem was that the whole Subject info was returned from
X.509 certs if they did not start with one of "CN", "OU", "O", "E"
Instead of extending this list with random keys, pass the type of cert
and only return the whole Subject info if it's an OpenGPG one, and
process the info unconditionally if it's X.509 like before the OpenGPG
integration
Change-Id: I1aa5d7285e48b0f4a769a073cdfb7732e482792c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92675
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmlsecurity')
4 files changed, 9 insertions, 9 deletions
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index 53a48e0e7863..f0ba29b080a4 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -204,11 +204,11 @@ void CertificateChooser::ImplInitialize() userData->xSecurityEnvironment = secEnvironment; mvUserData.push_back(userData); - OUString sIssuer = xmlsec::GetContentPart( xCert->getIssuerName() ); + OUString sIssuer = xmlsec::GetContentPart( xCert->getIssuerName(), xCert->getCertificateKind()); m_xCertLB->append(); int nRow = m_xCertLB->n_children() - 1; - m_xCertLB->set_text(nRow, xmlsec::GetContentPart(xCert->getSubjectName()), 0); + m_xCertLB->set_text(nRow, xmlsec::GetContentPart(xCert->getSubjectName(), xCert->getCertificateKind()), 0); m_xCertLB->set_text(nRow, sIssuer, 1); m_xCertLB->set_text(nRow, xmlsec::GetCertificateKind(xCert->getCertificateKind()), 2); m_xCertLB->set_text(nRow, utl::GetDateString(xCert->getNotValidAfter()), 3); diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index ef9237f5dacd..da924838c143 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -106,12 +106,12 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP(weld::Container* pParent, // insert data css::uno::Reference< css::security::XCertificate > xCert = mpDlg->mxCert; - OUString sSubjectName(xmlsec::GetContentPart(xCert->getSubjectName())); + OUString sSubjectName(xmlsec::GetContentPart(xCert->getSubjectName(), xCert->getCertificateKind())); if (!sSubjectName.isEmpty()) m_xIssuedToFT->set_label(sSubjectName); else m_xIssuedToLabelFT->hide(); - OUString sIssuerName(xmlsec::GetContentPart(xCert->getIssuerName())); + OUString sIssuerName(xmlsec::GetContentPart(xCert->getIssuerName(), xCert->getCertificateKind())); if (!sIssuerName.isEmpty()) m_xIssuedByFT->set_label(sIssuerName); else @@ -282,7 +282,7 @@ void CertificateViewerCertPathTP::ActivatePage() for (i = nCnt-1; i >= 0; i--) { const Reference< security::XCertificate > rCert = pCertPath[ i ]; - OUString sName = xmlsec::GetContentPart( rCert->getSubjectName() ); + OUString sName = xmlsec::GetContentPart( rCert->getSubjectName(), rCert->getCertificateKind() ); //Verify the certificate sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert, Sequence<Reference<css::security::XCertificate> >()); diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 5c1c7daf2785..d90bd33f9cfa 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -568,8 +568,8 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() bCertValid = false; } - aSubject = xmlsec::GetContentPart( xCert->getSubjectName() ); - aIssuer = xmlsec::GetContentPart( xCert->getIssuerName() ); + aSubject = xmlsec::GetContentPart( xCert->getSubjectName(), xCert->getCertificateKind() ); + aIssuer = xmlsec::GetContentPart( xCert->getIssuerName(), xCert->getCertificateKind() ); } else if (!rInfo.ouGpgCertificate.isEmpty()) { diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index 0fbdbcf57323..1596e327dc6f 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -340,8 +340,8 @@ void MacroSecurityTrustedSourcesTP::FillCertLB(const bool bShowWarnings) { // create from RawData uno::Reference< css::security::XCertificate > xCert = m_pDlg->m_xSecurityEnvironment->createCertificateFromAscii(rEntry[2]); - m_xTrustCertLB->append(OUString::number(nEntry), xmlsec::GetContentPart(xCert->getSubjectName())); - m_xTrustCertLB->set_text(nEntry, xmlsec::GetContentPart(xCert->getIssuerName()), 1); + m_xTrustCertLB->append(OUString::number(nEntry), xmlsec::GetContentPart(xCert->getSubjectName(), xCert->getCertificateKind())); + m_xTrustCertLB->set_text(nEntry, xmlsec::GetContentPart(xCert->getIssuerName(), xCert->getCertificateKind()), 1); m_xTrustCertLB->set_text(nEntry, utl::GetDateTimeString(xCert->getNotValidAfter()), 2); } catch (...) |