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/.
12 #include <sal/config.h>
16 #include <rtl/ustring.hxx>
17 #include <cppuhelper/implbase.hxx>
19 #include <com/sun/star/uno/Reference.hxx>
20 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
22 namespace com::sun::star::security
{ class XCertificate
; }
23 namespace GpgME
{ class Context
; }
25 class SecurityEnvironmentGpg
: public cppu::WeakImplHelper
< css::xml::crypto::XSecurityEnvironment
>
27 std::shared_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 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > SAL_CALL
getPersonalCertificates() override
;
47 /** We reinterpret the first parameter (originally issuerName) as keyId. We have no other way to identify a gpg key. */
48 virtual css::uno::Reference
< css::security::XCertificate
> SAL_CALL
getCertificate( const OUString
& keyId
, const css::uno::Sequence
< sal_Int8
>& serialNumber
) override
;
50 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > SAL_CALL
buildCertificatePath(
51 const css::uno::Reference
< css::security::XCertificate
>& beginCert
) override
;
53 virtual css::uno::Reference
< css::security::XCertificate
> SAL_CALL
createCertificateFromRaw(
54 const css::uno::Sequence
< sal_Int8
>& rawCertificate
) override
;
55 virtual css::uno::Reference
< css::security::XCertificate
> SAL_CALL
createCertificateFromAscii(
56 const OUString
& asciiCertificate
) override
;
58 GpgME::Context
& getGpgContext() { return *m_ctx
; }
59 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > SAL_CALL
getAllCertificates() override
;
62 css::uno::Sequence
< css::uno::Reference
< css::security::XCertificate
> > getCertificatesImpl( bool bPrivateOnly
);
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */