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 _SANEXTENSION_MSCRYPTIMPL_HXX_
25 #define _SANEXTENSION_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/implbase1.hxx>
39 #include <com/sun/star/uno/Exception.hpp>
40 #include "com/sun/star/uno/SecurityException.hpp"
41 #include <com/sun/star/uno/Exception.hpp>
42 #include <com/sun/star/security/XCertificateExtension.hpp>
43 #include <com/sun/star/security/XSanExtension.hpp>
44 #include <com/sun/star/security/CertAltNameEntry.hpp>
45 
46 class SanExtensionImpl : public ::cppu::WeakImplHelper1<
47     ::com::sun::star::security::XSanExtension >
48 {
49 	private :
50 		sal_Bool m_critical ;
51 		::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ;
52 		::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ;
53 
54         ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries;
55 
56 	public :
57 		SanExtensionImpl() ;
58 		virtual ~SanExtensionImpl() ;
59 
60 		//Methods from XCertificateExtension
61 		virtual sal_Bool SAL_CALL isCritical() throw( ::com::sun::star::uno::RuntimeException ) ;
62 
63 		virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) ;
64 
65 		virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) ;
66 
67         //Methods from XSanExtension
68 
69 		virtual ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ) ;
70 
71 		//Helper method
72 		void setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) ;
73 
74 		void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ;
75 
76         void extractCertExt() ;
77 } ;
78 
79 #endif	// _CERTIFICATEEXTENSION_XMLSECIMPL_HXX_
80 
81