1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_XMLSECURITY_SOURCE_GPG_SECURITYENVIRONMENT_HXX
11 #define INCLUDED_XMLSECURITY_SOURCE_GPG_SECURITYENVIRONMENT_HXX
13 #include <sal/config.h>
14 #include <rtl/ustring.hxx>
15 #include <cppuhelper/implbase.hxx>
17 #include <com/sun/star/uno/Reference.hxx>
18 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
19 #include <com/sun/star/lang/XUnoTunnel.hpp>
21 namespace com::sun::star::security
{ class XCertificate
; }
22 namespace GpgME
{ class Context
; }
24 class SecurityEnvironmentGpg
: public cppu::WeakImplHelper
< css::xml::crypto::XSecurityEnvironment
,
25 css::lang::XUnoTunnel
>
27 std::unique_ptr
<GpgME::Context
> m_ctx
;
30 SecurityEnvironmentGpg();
31 virtual ~SecurityEnvironmentGpg() override
;
33 //Methods from XSecurityEnvironment
34 virtual ::sal_Int32 SAL_CALL
verifyCertificate(
35 const css::uno::Reference
<
36 css::security::XCertificate
>& xCert
,
37 const css::uno::Sequence
<
38 css::uno::Reference
< css::security::XCertificate
> > &
39 intermediateCerts
) override
;
41 virtual ::sal_Int32 SAL_CALL
getCertificateCharacters( const css::uno::Reference
< css::security::XCertificate
>& xCert
) override
;
43 virtual OUString SAL_CALL
getSecurityEnvironmentInformation() override
;
45 //Methods from XUnoTunnel
46 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& aIdentifier
) override
;
48 static const css::uno::Sequence
< sal_Int8
>& getUnoTunnelId() ;
50 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > SAL_CALL
getPersonalCertificates() override
;
52 /** We reinterpret the first parameter (originally issuerName) as keyId. We have no other way to identify a gpg key. */
53 virtual css::uno::Reference
< css::security::XCertificate
> SAL_CALL
getCertificate( const OUString
& keyId
, const css::uno::Sequence
< sal_Int8
>& serialNumber
) override
;
55 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > SAL_CALL
buildCertificatePath(
56 const css::uno::Reference
< css::security::XCertificate
>& beginCert
) override
;
58 virtual css::uno::Reference
< css::security::XCertificate
> SAL_CALL
createCertificateFromRaw(
59 const css::uno::Sequence
< sal_Int8
>& rawCertificate
) override
;
60 virtual css::uno::Reference
< css::security::XCertificate
> SAL_CALL
createCertificateFromAscii(
61 const OUString
& asciiCertificate
) override
;
63 GpgME::Context
& getGpgContext() { return *m_ctx
; }
64 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > SAL_CALL
getAllCertificates() override
;
67 css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > getCertificatesImpl( bool bPrivateOnly
);
70 #endif // INCLUDED_XMLSECURITY_SOURCE_GPG_SECURITYENVIRONMENT_HXX
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */