From 6bcc2e1b3c461ef2688aa661b1a0fcf8fec9acc3 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Tue, 14 Mar 2017 22:28:42 +0100 Subject: gpg4libre: More details for certificates Change-Id: I9eee6c55d7ec27e28d844de2ed544040b07fa501 Reviewed-on: https://gerrit.libreoffice.org/35203 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens --- xmlsecurity/source/gpg/CertificateImpl.cxx | 34 ++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'xmlsecurity') diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx index 2bcc8f026161..a00b0336fee1 100644 --- a/xmlsecurity/source/gpg/CertificateImpl.cxx +++ b/xmlsecurity/source/gpg/CertificateImpl.cxx @@ -35,17 +35,23 @@ sal_Int16 SAL_CALL CertificateImpl::getVersion() Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSerialNumber() { + // Empty for gpg return Sequence< sal_Int8 > (); } OUString SAL_CALL CertificateImpl::getIssuerName() { - return OStringToOUString(m_pKey.userID(0).name(), RTL_TEXTENCODING_UTF8); + const GpgME::UserID userId = m_pKey.userID(0); + if (userId.isNull()) + return OUString(); + + return OStringToOUString(userId.id(), RTL_TEXTENCODING_UTF8); } OUString SAL_CALL CertificateImpl::getSubjectName() { - return OUString(""); + // Empty for gpg + return OUString(); } namespace { @@ -83,32 +89,41 @@ DateTime SAL_CALL CertificateImpl::getNotValidAfter() Sequence< sal_Int8 > SAL_CALL CertificateImpl::getIssuerUniqueID() { + // Empty for gpg return Sequence< sal_Int8 > (); } Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSubjectUniqueID() { + // Empty for gpg return Sequence< sal_Int8 > (); } Sequence< Reference< XCertificateExtension > > SAL_CALL CertificateImpl::getExtensions() { + // Empty for gpg return Sequence< Reference< XCertificateExtension > > (); } Reference< XCertificateExtension > SAL_CALL CertificateImpl::findCertificateExtension( const Sequence< sal_Int8 >& /*oid*/ ) { + // Empty for gpg return Reference< XCertificateExtension > (); } Sequence< sal_Int8 > SAL_CALL CertificateImpl::getEncoded() { + // Empty for gpg return Sequence< sal_Int8 > (); } OUString SAL_CALL CertificateImpl::getSubjectPublicKeyAlgorithm() { - return OUString(); + const GpgME::Subkey subkey = m_pKey.subkey(0); + if (subkey.isNull()) + return OUString(); + + return OStringToOUString(subkey.publicKeyAlgorithmAsString(), RTL_TEXTENCODING_UTF8); } Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSubjectPublicKeyValue() @@ -118,21 +133,32 @@ Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSubjectPublicKeyValue() OUString SAL_CALL CertificateImpl::getSignatureAlgorithm() { - return OUString(); + const GpgME::UserID userId = m_pKey.userID(0); + if (userId.isNull()) + return OUString(); + + const GpgME::UserID::Signature signature = userId.signature(0); + if (signature.isNull()) + return OUString(); + + return OStringToOUString(signature.algorithmAsString(), RTL_TEXTENCODING_UTF8); } Sequence< sal_Int8 > SAL_CALL CertificateImpl::getSHA1Thumbprint() { + // Empty for gpg return Sequence< sal_Int8 > (); } uno::Sequence CertificateImpl::getSHA256Thumbprint() { + // Empty for gpg return Sequence< sal_Int8 > (); } Sequence< sal_Int8 > SAL_CALL CertificateImpl::getMD5Thumbprint() { + // Empty for gpg return Sequence< sal_Int8 > (); } -- cgit