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_NSSIMPL_HXX_
25 #define _SANEXTENSION_NSSIMPL_HXX_
26 
27 #include <sal/config.h>
28 #include <rtl/ustring.hxx>
29 #include <cppuhelper/factory.hxx>
30 #include <cppuhelper/implbase1.hxx>
31 #include <com/sun/star/uno/Exception.hpp>
32 #include "com/sun/star/uno/SecurityException.hpp"
33 #include <com/sun/star/uno/Exception.hpp>
34 #include <com/sun/star/security/XCertificateExtension.hpp>
35 #include <com/sun/star/security/XSanExtension.hpp>
36 #include <com/sun/star/security/CertAltNameEntry.hpp>
37 
38 class SanExtensionImpl : public ::cppu::WeakImplHelper1<
39     ::com::sun::star::security::XSanExtension >
40 {
41 	private :
42 		sal_Bool m_critical ;
43 		::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ;
44 		::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ;
45         ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries;
46 
47 		::rtl::OString removeOIDFromString( const ::rtl::OString &oid);
48 
49 	public :
50 		SanExtensionImpl() ;
51 		virtual ~SanExtensionImpl() ;
52 
53 		//Methods from XCertificateExtension
54 		virtual sal_Bool SAL_CALL isCritical() throw( ::com::sun::star::uno::RuntimeException ) ;
55 
56 		virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) ;
57 
58 		virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) ;
59 
60         //Methods from XSanExtension
61 
62 		virtual ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ) ;
63 
64 		//Helper method
65 		void setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) ;
66 
67 		void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ;
68 
69         void extractCertExt() ;
70 } ;
71 
72 #endif	// _CERTIFICATEEXTENSION_XMLSECIMPL_HXX_
73 
74