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 <certificate.hxx>
14 #include <sal/types.h>
15 #include <sal/config.h>
16 #include <rtl/ustring.hxx>
17 #include <cppuhelper/implbase.hxx>
19 #include <com/sun/star/uno/Sequence.hxx>
20 #include <com/sun/star/lang/XServiceInfo.hpp>
21 #include <com/sun/star/security/CertificateKind.hpp>
22 #include <com/sun/star/security/XCertificate.hpp>
24 #if defined _MSC_VER && defined __clang__
25 #pragma clang diagnostic push
26 #pragma clang diagnostic ignored "-Wundef"
29 #if defined _MSC_VER && defined __clang__
30 #pragma clang diagnostic pop
33 class CertificateImpl
: public cppu::WeakImplHelper
< css::security::XCertificate
,
34 css::lang::XServiceInfo
>,
35 public xmlsecurity::Certificate
39 std::shared_ptr
<GpgME::Context
> m_pContext
;
40 css::uno::Sequence
< sal_Int8
> m_aBits
;
44 virtual ~CertificateImpl() override
;
46 //Methods from XCertificate
47 virtual sal_Int16 SAL_CALL
getVersion() override
;
49 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getSerialNumber() override
;
51 virtual OUString SAL_CALL
getIssuerName() override
;
52 virtual OUString SAL_CALL
getSubjectName() override
;
54 virtual css::util::DateTime SAL_CALL
getNotValidBefore() override
;
55 virtual css::util::DateTime SAL_CALL
getNotValidAfter() override
;
57 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getIssuerUniqueID() override
;
58 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getSubjectUniqueID() override
;
60 virtual css::uno::Sequence
< css::uno::Reference
< css::security::XCertificateExtension
> > SAL_CALL
getExtensions() override
;
62 virtual css::uno::Reference
< css::security::XCertificateExtension
> SAL_CALL
findCertificateExtension(const css::uno::Sequence
< sal_Int8
>& oid
) override
;
64 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getEncoded() override
;
66 virtual OUString SAL_CALL
getSubjectPublicKeyAlgorithm() override
;
68 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getSubjectPublicKeyValue() override
;
70 virtual OUString SAL_CALL
getSignatureAlgorithm() override
;
72 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getSHA1Thumbprint() override
;
74 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getMD5Thumbprint() override
;
76 virtual sal_Int32 SAL_CALL
getCertificateUsage() override
;
78 /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
79 virtual css::uno::Sequence
<sal_Int8
> getSHA256Thumbprint() override
;
80 /// @see xmlsecurity::Certificate::getSignatureMethodAlgorithm().
81 virtual svl::crypto::SignatureMethodAlgorithm
getSignatureMethodAlgorithm() override
;
82 virtual css::security::CertificateKind SAL_CALL
getCertificateKind() override
;
85 void setCertificate(const std::shared_ptr
<GpgME::Context
>& ctx
, const GpgME::Key
& key
);
86 const GpgME::Key
* getCertificate() const;
89 virtual OUString SAL_CALL
getImplementationName() override
;
90 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
91 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */