fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / xmlsecurity / source / xmlsec / nss / securityenvironment_nssimpl.hxx
blob482909936a916efd0a27a124d530eccba3d85eb7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _XSECURITYENVIRONMENT_NSSIMPL_HXX_
21 #define _XSECURITYENVIRONMENT_NSSIMPL_HXX_
23 #include <sal/config.h>
24 #include <rtl/ustring.hxx>
25 #include <cppuhelper/factory.hxx>
26 #include <cppuhelper/implbase4.hxx>
27 #include <com/sun/star/uno/Exception.hpp>
29 #include <com/sun/star/uno/Reference.hxx>
30 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
35 #include <com/sun/star/security/XCertificate.hpp>
36 #include <com/sun/star/security/CertificateCharacters.hpp>
37 #include <com/sun/star/security/CertificateValidity.hpp>
38 #include <com/sun/star/lang/XUnoTunnel.hpp>
40 #include "osl/mutex.hxx"
42 #include "pk11func.h"
43 #include "keyhi.h"
44 #include "certdb.h"
45 #include "list"
47 #include "xmlsecurity/xmlsec-wrapper.h"
49 class SecurityEnvironment_NssImpl : public ::cppu::WeakImplHelper4<
50 ::com::sun::star::xml::crypto::XSecurityEnvironment ,
51 ::com::sun::star::lang::XInitialization ,
52 ::com::sun::star::lang::XServiceInfo ,
53 ::com::sun::star::lang::XUnoTunnel >
55 private :
57 std::list< PK11SlotInfo* > m_Slots;
58 typedef std::list< PK11SlotInfo* >::const_iterator CIT_SLOTS;
60 osl::Mutex m_mutex;
62 CERTCertDBHandle* m_pHandler ;
63 std::list< PK11SymKey* > m_tSymKeyList ;
64 std::list< SECKEYPublicKey* > m_tPubKeyList ;
65 std::list< SECKEYPrivateKey* > m_tPriKeyList ;
66 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ;
68 public :
69 SecurityEnvironment_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aFactory ) ;
70 virtual ~SecurityEnvironment_NssImpl() ;
72 //Methods from XSecurityEnvironment
74 //Methods from XInitialization
75 virtual void SAL_CALL initialize(
76 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments
77 ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
79 //Methods from XServiceInfo
80 virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ;
82 virtual sal_Bool SAL_CALL supportsService(
83 const OUString& ServiceName
84 ) throw( ::com::sun::star::uno::RuntimeException ) ;
86 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) ;
88 //Helper for XServiceInfo
89 static ::com::sun::star::uno::Sequence< OUString > impl_getSupportedServiceNames() ;
91 static OUString impl_getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ;
93 //Helper for registry
94 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 ) ;
96 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 ) ;
98 virtual ::sal_Int32 SAL_CALL verifyCertificate(
99 const ::com::sun::star::uno::Reference<
100 ::com::sun::star::security::XCertificate >& xCert,
101 const ::com::sun::star::uno::Sequence<
102 ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > > &
103 intermediateCerts)
104 throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ;
106 virtual ::sal_Int32 SAL_CALL getCertificateCharacters( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert ) throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ;
108 virtual OUString SAL_CALL getSecurityEnvironmentInformation( ) throw (::com::sun::star::uno::RuntimeException);
110 //Methods from XUnoTunnel
111 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
112 throw (::com::sun::star::uno::RuntimeException);
114 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
116 //Native mehtods
117 virtual CERTCertDBHandle* getCertDb() throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
119 virtual void setCertDb( CERTCertDBHandle* aCertDb ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
121 virtual void adoptSymKey( PK11SymKey* aSymKey ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
122 virtual void rejectSymKey( PK11SymKey* aSymKey ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
123 virtual PK11SymKey* getSymKey( unsigned int position ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
125 virtual void adoptPubKey( SECKEYPublicKey* aPubKey ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
126 virtual void rejectPubKey( SECKEYPublicKey* aPubKey ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
127 virtual SECKEYPublicKey* getPubKey( unsigned int position ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
129 virtual void adoptPriKey( SECKEYPrivateKey* aPriKey ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
130 virtual void rejectPriKey( SECKEYPrivateKey* aPriKey ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
131 virtual SECKEYPrivateKey* getPriKey( unsigned int position ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
133 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > > SAL_CALL getPersonalCertificates() throw( ::com::sun::star::uno::SecurityException , ::com::sun::star::uno::RuntimeException ) ;
135 virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > SAL_CALL getCertificate( const OUString& issuerName, const ::com::sun::star::uno::Sequence< sal_Int8 >& serialNumber ) throw( ::com::sun::star::uno::SecurityException , ::com::sun::star::uno::RuntimeException ) ;
136 virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > SAL_CALL getCertificate( const OUString& issuerName, const OUString& serialNumber ) throw( ::com::sun::star::uno::SecurityException , ::com::sun::star::uno::RuntimeException ) ;
138 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > > SAL_CALL buildCertificatePath( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& beginCert ) throw( ::com::sun::star::uno::SecurityException , ::com::sun::star::uno::RuntimeException ) ;
140 virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > SAL_CALL createCertificateFromRaw( const ::com::sun::star::uno::Sequence< sal_Int8 >& rawCertificate ) throw( ::com::sun::star::uno::SecurityException , ::com::sun::star::uno::RuntimeException ) ;
141 virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > SAL_CALL createCertificateFromAscii( const OUString& asciiCertificate ) throw( ::com::sun::star::uno::SecurityException , ::com::sun::star::uno::RuntimeException ) ;
144 //Native mehtods
145 virtual xmlSecKeysMngrPtr createKeysManager() throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
146 virtual void destroyKeysManager(xmlSecKeysMngrPtr pKeysMngr) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
148 private:
149 void updateSlots();
151 virtual void addCryptoSlot( PK11SlotInfo* aSlot ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
154 #endif // _XSECURITYENVIRONMENT_NSSIMPL_HXX_
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */