summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-12 11:30:28 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-07 12:28:40 +0200
commit696c88cd3acc4b37f61cf9a399d5a46256073617 (patch)
treec5a18c186d89328258ae1b1ab4f06cd9ece685db /xmlsecurity
parent4419a09e263c9990d5adeece360b6701d5964a8b (diff)
xmlsecurity: implement Certificate interface in X509Certificate_MSCryptImpl
Change-Id: Idf60c9adcbc6d7467df92b48995bcb5c0bc3465b Reviewed-on: https://gerrit.libreoffice.org/22308 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 718dd3742be309a77c5e22af799abc964cf1a3e0)
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx10
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx6
2 files changed, 13 insertions, 3 deletions
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index d66c616bb855..a15872e28b04 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -33,6 +33,7 @@
#include <utility>
#include <tools/time.hxx>
+using namespace com::sun::star;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::security ;
@@ -508,8 +509,8 @@ OUString findOIDDescription(char *oid)
{
if( pCertContext != NULL )
{
- DWORD cbData = 20;
- unsigned char fingerprint[20];
+ DWORD cbData = dwPropId == CERT_SHA256_HASH_PROP_ID ? 32 : 20;
+ unsigned char fingerprint[32];
if (CertGetCertificateContextProperty(pCertContext, dwPropId, (void*)fingerprint, &cbData))
{
Sequence< sal_Int8 > thumbprint( cbData ) ;
@@ -579,6 +580,11 @@ OUString SAL_CALL X509Certificate_MSCryptImpl::getSignatureAlgorithm()
}
}
+uno::Sequence<sal_Int8> X509Certificate_MSCryptImpl::getSHA256Thumbprint() throw (uno::RuntimeException, std::exception)
+{
+ return getThumbprint(m_pCertContext, CERT_SHA256_HASH_PROP_ID);
+}
+
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getSHA1Thumbprint()
throw ( ::com::sun::star::uno::RuntimeException)
{
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
index 674940bbe192..bbe34451b9fb 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
@@ -36,10 +36,11 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/SecurityException.hpp>
#include <com/sun/star/security/XCertificate.hpp>
+#include <certificate.hxx>
class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper<
::com::sun::star::security::XCertificate ,
- ::com::sun::star::lang::XUnoTunnel >
+ ::com::sun::star::lang::XUnoTunnel > , public xmlsecurity::Certificate
{
private:
const CERT_CONTEXT* m_pCertContext ;
@@ -77,6 +78,9 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper<
//Methods from XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (com::sun::star::uno::RuntimeException);
+ /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
+ virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() throw (css::uno::RuntimeException, std::exception) override;
+
static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
static X509Certificate_MSCryptImpl* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rObj ) ;