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/factory.hxx>
16 #include <cppuhelper/implbase.hxx>
17 #include <com/sun/star/uno/Exception.hpp>
19 #include <com/sun/star/uno/Reference.hxx>
20 #include <com/sun/star/uno/SecurityException.hpp>
21 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
22 #include <com/sun/star/security/XCertificate.hpp>
23 #include <com/sun/star/security/CertificateCharacters.hpp>
24 #include <com/sun/star/security/CertificateValidity.hpp>
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
30 class SecurityEnvironmentGpg
: public cppu::WeakImplHelper
< css::xml::crypto::XSecurityEnvironment
,
31 css::lang::XUnoTunnel
>
33 std::unique_ptr
<GpgME::Context
> m_ctx
;
36 SecurityEnvironmentGpg();
37 virtual ~SecurityEnvironmentGpg() override
;
39 //Methods from XSecurityEnvironment
40 virtual ::sal_Int32 SAL_CALL
verifyCertificate(
41 const css::uno::Reference
<
42 css::security::XCertificate
>& xCert
,
43 const css::uno::Sequence
<
44 css::uno::Reference
< css::security::XCertificate
> > &
45 intermediateCerts
) override
;
47 virtual ::sal_Int32 SAL_CALL
getCertificateCharacters( const css::uno::Reference
< css::security::XCertificate
>& xCert
) override
;
49 virtual OUString SAL_CALL
getSecurityEnvironmentInformation() override
;
51 //Methods from XUnoTunnel
52 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& aIdentifier
) override
;
54 static const css::uno::Sequence
< sal_Int8
>& getUnoTunnelId() ;
56 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > SAL_CALL
getPersonalCertificates() override
;
58 /** We reinterpret the first parameter (originally issuerName) as keyId. We have no other way to identify a gpg key. */
59 virtual css::uno::Reference
< css::security::XCertificate
> SAL_CALL
getCertificate( const OUString
& keyId
, const css::uno::Sequence
< sal_Int8
>& serialNumber
) override
;
61 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > SAL_CALL
buildCertificatePath(
62 const css::uno::Reference
< css::security::XCertificate
>& beginCert
) override
;
64 virtual css::uno::Reference
< css::security::XCertificate
> SAL_CALL
createCertificateFromRaw(
65 const css::uno::Sequence
< sal_Int8
>& rawCertificate
) override
;
66 virtual css::uno::Reference
< css::security::XCertificate
> SAL_CALL
createCertificateFromAscii(
67 const OUString
& asciiCertificate
) override
;
69 GpgME::Context
& getGpgContext() { return *m_ctx
.get(); }
70 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > SAL_CALL
getAllCertificates() override
;
73 css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > getCertificatesImpl( bool bPrivateOnly
);
76 #endif // INCLUDED_XMLSECURITY_SOURCE_GPG_SECURITYENVIRONMENT_HXX
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */