xref: /trunk/main/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _X509CERTIFICATE_MSCRYPTIMPL_HXX_
25 #define _X509CERTIFICATE_MSCRYPTIMPL_HXX_
26 
27 #ifdef _MSC_VER
28 #pragma warning(push,1)
29 #endif
30 #include "Windows.h"
31 #include "WinCrypt.h"
32 #ifdef _MSC_VER
33 #pragma warning(pop)
34 #endif
35 #include <sal/config.h>
36 #include <rtl/ustring.hxx>
37 #include <cppuhelper/factory.hxx>
38 #include <cppuhelper/implbase2.hxx>
39 #include <com/sun/star/uno/Exception.hpp>
40 #include <com/sun/star/lang/XUnoTunnel.hpp>
41 #include <com/sun/star/uno/SecurityException.hpp>
42 #include <com/sun/star/security/XCertificate.hpp>
43 
44 class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper2<
45     ::com::sun::star::security::XCertificate ,
46     ::com::sun::star::lang::XUnoTunnel >
47 {
48     private :
49         const CERT_CONTEXT* m_pCertContext ;
50 
51     public :
52         X509Certificate_MSCryptImpl() ;
53         virtual ~X509Certificate_MSCryptImpl() ;
54 
55         //Methods from XCertificate
56         virtual sal_Int16 SAL_CALL getVersion() ;
57 
58         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber() ;
59 
60         virtual ::rtl::OUString SAL_CALL getIssuerName() ;
61 
62         virtual ::rtl::OUString SAL_CALL getSubjectName() ;
63 
64         virtual ::com::sun::star::util::DateTime SAL_CALL getNotValidBefore() ;
65 
66         virtual ::com::sun::star::util::DateTime SAL_CALL getNotValidAfter() ;
67 
68         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID() ;
69 
70         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID() ;
71 
72         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificateExtension > > SAL_CALL getExtensions() ;
73 
74         virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificateExtension > SAL_CALL findCertificateExtension( const ::com::sun::star::uno::Sequence< sal_Int8 >& oid ) ;
75 
76         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getEncoded() ;
77 
78         // MM : added by MM
79         virtual ::rtl::OUString SAL_CALL getSubjectPublicKeyAlgorithm() ;
80 
81         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue() ;
82 
83         virtual ::rtl::OUString SAL_CALL getSignatureAlgorithm() ;
84 
85         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint() ;
86 
87         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint() ;
88 
89         virtual sal_Int32 SAL_CALL getCertificateUsage( ) ;
90         // MM : end
91 
92         //Methods from XUnoTunnel
93         virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier );
94 
95         static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
96         static X509Certificate_MSCryptImpl* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj ) ;
97 
98         //Helper methods
99         void setMswcryCert( const CERT_CONTEXT* cert ) ;
100         const CERT_CONTEXT* getMswcryCert() const ;
101         void setRawCert( ::com::sun::star::uno::Sequence< sal_Int8 > rawCert ) ;
102 } ;
103 
104 #endif  // _X509CERTIFICATE_MSCRYPTIMPL_HXX_
105