1*ec61c6edSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ec61c6edSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ec61c6edSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ec61c6edSAndrew Rist * distributed with this work for additional information 6*ec61c6edSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ec61c6edSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ec61c6edSAndrew Rist * "License"); you may not use this file except in compliance 9*ec61c6edSAndrew Rist * with the License. You may obtain a copy of the License at 10*ec61c6edSAndrew Rist * 11*ec61c6edSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ec61c6edSAndrew Rist * 13*ec61c6edSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ec61c6edSAndrew Rist * software distributed under the License is distributed on an 15*ec61c6edSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ec61c6edSAndrew Rist * KIND, either express or implied. See the License for the 17*ec61c6edSAndrew Rist * specific language governing permissions and limitations 18*ec61c6edSAndrew Rist * under the License. 19*ec61c6edSAndrew Rist * 20*ec61c6edSAndrew Rist *************************************************************/ 21*ec61c6edSAndrew Rist 22*ec61c6edSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _XCERTIFICATECONTAINER_HXX_ 25cdf0e10cSrcweir #define _XCERTIFICATECONTAINER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 28cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 29cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 30cdf0e10cSrcweir #include <cppuhelper/factory.hxx> 31cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #ifndef _XCERTIFICATECONTAINER_HPP_ 34cdf0e10cSrcweir #include <com/sun/star/security/XCertificateContainer.hpp> 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir 37cdf0e10cSrcweir #ifndef _CERTIFICATECONTAINERSTATUS_HPP_ 38cdf0e10cSrcweir #include <com/sun/star/security/CertificateContainerStatus.hpp> 39cdf0e10cSrcweir #endif 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <vector> 43cdf0e10cSrcweir #include <map> 44cdf0e10cSrcweir 45cdf0e10cSrcweir using namespace com::sun::star; 46cdf0e10cSrcweir using namespace cppu; 47cdf0e10cSrcweir using namespace ::com::sun::star::uno; 48cdf0e10cSrcweir using namespace ::com::sun::star::lang; 49cdf0e10cSrcweir 50cdf0e10cSrcweir class CertificateContainer : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::security::XCertificateContainer > 51cdf0e10cSrcweir { 52cdf0e10cSrcweir private: 53cdf0e10cSrcweir typedef std::map< ::rtl::OUString, ::rtl::OUString > Map; 54cdf0e10cSrcweir Map certMap; 55cdf0e10cSrcweir Map certTrustMap; 56cdf0e10cSrcweir 57cdf0e10cSrcweir ::sal_Bool SAL_CALL searchMap( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name, Map &_certMap ); 58cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isTemporaryCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ) throw(::com::sun::star::uno::RuntimeException); 59cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isCertificateTrust( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ) throw(::com::sun::star::uno::RuntimeException); 60cdf0e10cSrcweir 61cdf0e10cSrcweir public: 62cdf0e10cSrcweir CertificateContainer(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> &)63cdf0e10cSrcweir CertificateContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) {}; ~CertificateContainer()64cdf0e10cSrcweir virtual ~CertificateContainer(){}; 65cdf0e10cSrcweir 66cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL addCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name, ::sal_Bool trust ) throw(::com::sun::star::uno::RuntimeException); 67cdf0e10cSrcweir virtual ::security::CertificateContainerStatus SAL_CALL hasCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ) throw(::com::sun::star::uno::RuntimeException); 68cdf0e10cSrcweir // provide factory 69cdf0e10cSrcweir static ::rtl::OUString SAL_CALL 70cdf0e10cSrcweir impl_getStaticImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 71cdf0e10cSrcweir 72cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 73cdf0e10cSrcweir impl_getStaticSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 74cdf0e10cSrcweir 75cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL 76cdf0e10cSrcweir impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager ) throw(::com::sun::star::uno::RuntimeException); 77cdf0e10cSrcweir 78cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 79cdf0e10cSrcweir impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) throw( ::com::sun::star::uno::RuntimeException ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir // XServiceInfo 82cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 83cdf0e10cSrcweir getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 84cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL 85cdf0e10cSrcweir supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 86cdf0e10cSrcweir 87cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 88cdf0e10cSrcweir getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 89cdf0e10cSrcweir 90cdf0e10cSrcweir }; 91cdf0e10cSrcweir 92cdf0e10cSrcweir 93cdf0e10cSrcweir 94cdf0e10cSrcweir #endif 95cdf0e10cSrcweir 96