tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / xmlsecurity / source / gpg / CertificateImpl.hxx
blobb8499b7135a94553ef109a396b4fd1e809ae7674
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/.
8 */
10 #pragma once
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"
27 #endif
28 #include <key.h>
29 #if defined _MSC_VER && defined __clang__
30 #pragma clang diagnostic pop
31 #endif
33 class CertificateImpl : public cppu::WeakImplHelper< css::security::XCertificate,
34 css::lang::XServiceInfo >,
35 public xmlsecurity::Certificate
37 private:
38 GpgME::Key m_pKey;
39 std::shared_ptr<GpgME::Context> m_pContext;
40 css::uno::Sequence< sal_Int8 > m_aBits;
42 public:
43 CertificateImpl();
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;
84 // Helper methods
85 void setCertificate(const std::shared_ptr<GpgME::Context>& ctx, const GpgME::Key& key);
86 const GpgME::Key* getCertificate() const;
88 // XServiceInfo
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;
92 } ;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */