1*ebfcd9afSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ebfcd9afSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ebfcd9afSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ebfcd9afSAndrew Rist  * distributed with this work for additional information
6*ebfcd9afSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ebfcd9afSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ebfcd9afSAndrew Rist  * "License"); you may not use this file except in compliance
9*ebfcd9afSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ebfcd9afSAndrew Rist  *
11*ebfcd9afSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ebfcd9afSAndrew Rist  *
13*ebfcd9afSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ebfcd9afSAndrew Rist  * software distributed under the License is distributed on an
15*ebfcd9afSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ebfcd9afSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ebfcd9afSAndrew Rist  * specific language governing permissions and limitations
18*ebfcd9afSAndrew Rist  * under the License.
19*ebfcd9afSAndrew Rist  *
20*ebfcd9afSAndrew Rist  *************************************************************/
21*ebfcd9afSAndrew Rist 
22*ebfcd9afSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SANEXTENSION_NSSIMPL_HXX_
25cdf0e10cSrcweir #define _SANEXTENSION_NSSIMPL_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <sal/config.h>
28cdf0e10cSrcweir #include <rtl/ustring.hxx>
29cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
30cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
31cdf0e10cSrcweir #include <com/sun/star/uno/Exception.hpp>
32cdf0e10cSrcweir #include "com/sun/star/uno/SecurityException.hpp"
33cdf0e10cSrcweir #include <com/sun/star/uno/Exception.hpp>
34cdf0e10cSrcweir #include <com/sun/star/security/XCertificateExtension.hpp>
35cdf0e10cSrcweir #include <com/sun/star/security/XSanExtension.hpp>
36cdf0e10cSrcweir #include <com/sun/star/security/CertAltNameEntry.hpp>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class SanExtensionImpl : public ::cppu::WeakImplHelper1<
39cdf0e10cSrcweir     ::com::sun::star::security::XSanExtension >
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	private :
42cdf0e10cSrcweir 		sal_Bool m_critical ;
43cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ;
44cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ;
45cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 		::rtl::OString removeOIDFromString( const ::rtl::OString &oid);
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 	public :
50cdf0e10cSrcweir 		SanExtensionImpl() ;
51cdf0e10cSrcweir 		virtual ~SanExtensionImpl() ;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 		//Methods from XCertificateExtension
54cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL isCritical() throw( ::com::sun::star::uno::RuntimeException ) ;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) ;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) ;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir         //Methods from XSanExtension
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ) ;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 		//Helper method
65cdf0e10cSrcweir 		void setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) ;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 		void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ;
68cdf0e10cSrcweir 
69cdf0e10cSrcweir         void extractCertExt() ;
70cdf0e10cSrcweir } ;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir #endif	// _CERTIFICATEEXTENSION_XMLSECIMPL_HXX_
73cdf0e10cSrcweir 
74