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 _XMLSIGNATURECONTEXT_NSSIMPL_HXX_ 25 #define _XMLSIGNATURECONTEXT_NSSIMPL_HXX_ 26 27 #include <sal/config.h> 28 #include <rtl/ustring.hxx> 29 #include <cppuhelper/factory.hxx> 30 #include <cppuhelper/implbase3.hxx> 31 #include <com/sun/star/uno/Exception.hpp> 32 33 #ifndef _COM_SUN_STAR_UNO_REFERENCE_HPP_ 34 #include <com/sun/star/uno/Reference.hxx> 35 #endif 36 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 37 38 #ifndef _COM_SUN_STAR_LANG_XSECVICEINFO_HPP_ 39 #include <com/sun/star/lang/XServiceInfo.hpp> 40 #endif 41 #include <com/sun/star/lang/XInitialization.hpp> 42 #include <com/sun/star/lang/XUnoTunnel.hpp> 43 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> 44 #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> 45 46 #ifndef INCLUDED_VECTOR 47 #include <vector> 48 #define INCLUDED_VECTOR 49 #endif 50 51 class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper3< 52 ::com::sun::star::xml::crypto::XXMLSecurityContext , 53 ::com::sun::star::lang::XInitialization , 54 ::com::sun::star::lang::XServiceInfo > 55 { 56 private : 57 //xmlSecKeysMngrPtr m_pKeysMngr ; 58 //::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment ; 59 std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > > m_vSecurityEnvironments; 60 61 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ; 62 63 sal_Int32 m_nDefaultEnvIndex; 64 65 public : 66 XMLSecurityContext_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aFactory ) ; 67 virtual ~XMLSecurityContext_NssImpl() ; 68 69 //Methods from XXMLSecurityContext 70 virtual sal_Int32 SAL_CALL addSecurityEnvironment( 71 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment >& aSecurityEnvironment 72 ) throw (::com::sun::star::security::SecurityInfrastructureException, ::com::sun::star::uno::RuntimeException); 73 74 virtual ::sal_Int32 SAL_CALL getSecurityEnvironmentNumber( ) 75 throw (::com::sun::star::uno::RuntimeException); 76 77 virtual ::com::sun::star::uno::Reference< 78 ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL 79 getSecurityEnvironmentByIndex( ::sal_Int32 index ) 80 throw (::com::sun::star::uno::RuntimeException); 81 82 virtual ::com::sun::star::uno::Reference< 83 ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL 84 getSecurityEnvironment( ) 85 throw (::com::sun::star::uno::RuntimeException); 86 87 virtual ::sal_Int32 SAL_CALL getDefaultSecurityEnvironmentIndex( ) 88 throw (::com::sun::star::uno::RuntimeException); 89 90 virtual void SAL_CALL setDefaultSecurityEnvironmentIndex( sal_Int32 nDefaultEnvIndex ) 91 throw (::com::sun::star::uno::RuntimeException); 92 93 //Methods from XInitialization 94 virtual void SAL_CALL initialize( 95 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments 96 ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; 97 98 //Methods from XServiceInfo 99 virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; 100 101 virtual sal_Bool SAL_CALL supportsService( 102 const ::rtl::OUString& ServiceName 103 ) throw( ::com::sun::star::uno::RuntimeException ) ; 104 105 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) ; 106 107 //Helper for XServiceInfo 108 static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames() ; 109 110 static ::rtl::OUString impl_getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; 111 112 //Helper for registry 113 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ) throw( ::com::sun::star::uno::RuntimeException ) ; 114 115 static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ) ; 116 117 /* 118 * Because of the issue of multi-securityenvironment, so the keyManager method is not useful any longer. 119 * 120 121 //Methods from XUnoTunnel 122 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) 123 throw (com::sun::star::uno::RuntimeException); 124 125 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId() ; 126 static XMLSecurityContext_NssImpl* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj ) ; 127 128 //Native methods 129 virtual xmlSecKeysMngrPtr keysManager() throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; 130 131 */ 132 } ; 133 134 #endif // _XMLSIGNATURECONTEXT_NSSIMPL_HXX_ 135 136