[Libreoffice-commits] core.git: xmlsecurity/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Feb 12 11:38:54 UTC 2016


 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx |   10 ++++++++--
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx |    6 +++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 718dd3742be309a77c5e22af799abc964cf1a3e0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Feb 12 11:30:28 2016 +0100

    xmlsecurity: implement Certificate interface in X509Certificate_MSCryptImpl
    
    Change-Id: Idf60c9adcbc6d7467df92b48995bcb5c0bc3465b
    Reviewed-on: https://gerrit.libreoffice.org/22308
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index 8287fab..af5abea 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 ;
 
@@ -507,8 +508,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 ) ;
@@ -578,6 +579,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 674940b..bbe3445 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 ) ;
 


More information about the Libreoffice-commits mailing list