Update ooo320-m1
[ooovba.git] / xmlsecurity / source / xmlsec / mscrypt / x509certificate_mscryptimpl.hxx
blob0f68b4a56ea49566b2b95997cf6a6dc773d990e4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: x509certificate_mscryptimpl.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _X509CERTIFICATE_MSCRYPTIMPL_HXX_
32 #define _X509CERTIFICATE_MSCRYPTIMPL_HXX_
34 #ifdef _MSC_VER
35 #pragma warning(push,1)
36 #endif
37 #include "Windows.h"
38 #include "WinCrypt.h"
39 #ifdef _MSC_VER
40 #pragma warning(pop)
41 #endif
42 #include <sal/config.h>
43 #include <rtl/ustring.hxx>
44 #include <cppuhelper/factory.hxx>
45 #include <cppuhelper/implbase2.hxx>
46 #include <com/sun/star/uno/Exception.hpp>
47 #include <com/sun/star/lang/XUnoTunnel.hpp>
48 #include <com/sun/star/uno/SecurityException.hpp>
49 #include <com/sun/star/security/XCertificate.hpp>
51 class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper2<
52 ::com::sun::star::security::XCertificate ,
53 ::com::sun::star::lang::XUnoTunnel >
55 private :
56 const CERT_CONTEXT* m_pCertContext ;
58 public :
59 X509Certificate_MSCryptImpl() ;
60 virtual ~X509Certificate_MSCryptImpl() ;
62 //Methods from XCertificate
63 virtual sal_Int16 SAL_CALL getVersion() throw ( ::com::sun::star::uno::RuntimeException) ;
65 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber() throw ( ::com::sun::star::uno::RuntimeException) ;
67 virtual ::rtl::OUString SAL_CALL getIssuerName() throw ( ::com::sun::star::uno::RuntimeException) ;
69 virtual ::rtl::OUString SAL_CALL getSubjectName() throw ( ::com::sun::star::uno::RuntimeException) ;
71 virtual ::com::sun::star::util::DateTime SAL_CALL getNotValidBefore() throw ( ::com::sun::star::uno::RuntimeException) ;
73 virtual ::com::sun::star::util::DateTime SAL_CALL getNotValidAfter() throw ( ::com::sun::star::uno::RuntimeException) ;
75 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID() throw ( ::com::sun::star::uno::RuntimeException) ;
77 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID() throw ( ::com::sun::star::uno::RuntimeException) ;
79 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificateExtension > > SAL_CALL getExtensions() throw ( ::com::sun::star::uno::RuntimeException) ;
81 virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificateExtension > SAL_CALL findCertificateExtension( const ::com::sun::star::uno::Sequence< sal_Int8 >& oid ) throw (::com::sun::star::uno::RuntimeException) ;
83 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getEncoded() throw ( ::com::sun::star::uno::RuntimeException) ;
85 // MM : added by MM
86 virtual ::rtl::OUString SAL_CALL getSubjectPublicKeyAlgorithm()
87 throw ( ::com::sun::star::uno::RuntimeException) ;
89 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue()
90 throw ( ::com::sun::star::uno::RuntimeException) ;
92 virtual ::rtl::OUString SAL_CALL getSignatureAlgorithm()
93 throw ( ::com::sun::star::uno::RuntimeException) ;
95 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint()
96 throw ( ::com::sun::star::uno::RuntimeException) ;
98 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint()
99 throw ( ::com::sun::star::uno::RuntimeException) ;
101 virtual sal_Int32 SAL_CALL getCertificateUsage( ) throw ( ::com::sun::star::uno::RuntimeException) ;
102 // MM : end
104 //Methods from XUnoTunnel
105 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (com::sun::star::uno::RuntimeException);
107 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
108 static X509Certificate_MSCryptImpl* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj ) ;
110 //Helper methods
111 void setMswcryCert( const CERT_CONTEXT* cert ) ;
112 const CERT_CONTEXT* getMswcryCert() const ;
113 void setRawCert( ::com::sun::star::uno::Sequence< sal_Int8 > rawCert ) throw ( ::com::sun::star::uno::RuntimeException) ;
116 #endif // _X509CERTIFICATE_MSCRYPTIMPL_HXX_