summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/gpg/CertificateImpl.cxx
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-03-14 22:28:42 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-03-16 11:27:55 +0000
commit6bcc2e1b3c461ef2688aa661b1a0fcf8fec9acc3 (patch)
tree31f18b162c26112aa019ffd4f9ee7c869b17d0b4 /xmlsecurity/source/gpg/CertificateImpl.cxx
parent055d8821e664446b7e66b73970a324f765e35f9c (diff)
gpg4libre: More details for certificates
Change-Id: I9eee6c55d7ec27e28d844de2ed544040b07fa501 Reviewed-on: https://gerrit.libreoffice.org/35203 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'xmlsecurity/source/gpg/CertificateImpl.cxx')
-rw-r--r--xmlsecurity/source/gpg/CertificateImpl.cxx34
1 files changed, 30 insertions, 4 deletions
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<sal_Int8> CertificateImpl::getSHA256Thumbprint()
{
+ // Empty for gpg
return Sequence< sal_Int8 > ();
}
Sequence< sal_Int8 > SAL_CALL CertificateImpl::getMD5Thumbprint()
{
+ // Empty for gpg
return Sequence< sal_Int8 > ();
}