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 _XCERTIFICATECONTAINER_HXX_
25 #define _XCERTIFICATECONTAINER_HXX_
26 
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <cppuhelper/factory.hxx>
31 #include <cppuhelper/implbase2.hxx>
32 
33 #ifndef _XCERTIFICATECONTAINER_HPP_
34 #include <com/sun/star/security/XCertificateContainer.hpp>
35 #endif
36 
37 #ifndef _CERTIFICATECONTAINERSTATUS_HPP_
38 #include <com/sun/star/security/CertificateContainerStatus.hpp>
39 #endif
40 
41 
42 #include <vector>
43 #include <map>
44 
45 using namespace com::sun::star;
46 using namespace cppu;
47 using namespace ::com::sun::star::uno;
48 using namespace ::com::sun::star::lang;
49 
50 class CertificateContainer : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::security::XCertificateContainer >
51 {
52     private:
53         typedef std::map< ::rtl::OUString, ::rtl::OUString > Map;
54         Map certMap;
55         Map certTrustMap;
56 
57         ::sal_Bool SAL_CALL searchMap( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name, Map &_certMap  );
58 		virtual ::sal_Bool SAL_CALL isTemporaryCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ) throw(::com::sun::star::uno::RuntimeException);
59         virtual ::sal_Bool SAL_CALL isCertificateTrust( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ) throw(::com::sun::star::uno::RuntimeException);
60 
61     public:
62 
CertificateContainer(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> &)63         CertificateContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) {};
~CertificateContainer()64         virtual ~CertificateContainer(){};
65 
66         virtual ::sal_Bool SAL_CALL addCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name, ::sal_Bool trust ) throw(::com::sun::star::uno::RuntimeException);
67 		virtual ::security::CertificateContainerStatus SAL_CALL hasCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ) throw(::com::sun::star::uno::RuntimeException);
68         // provide factory
69 	static ::rtl::OUString SAL_CALL
70                                         impl_getStaticImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
71 
72 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
73 					impl_getStaticSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
74 
75 	static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL
76 					impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager ) throw(::com::sun::star::uno::RuntimeException);
77 
78 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
79 					impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) throw( ::com::sun::star::uno::RuntimeException );
80 
81 	// XServiceInfo
82 	virtual ::rtl::OUString	SAL_CALL
83                                         getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
84         virtual ::sal_Bool SAL_CALL
85                                         supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
86 
87 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
88                                         getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
89 
90 };
91 
92 
93 
94 #endif
95 
96