Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / xmlsecurity / source / gpg / CertificateImpl.hxx
blobcb947f0f435b3b4d922e1a892ace84b3805e8f3d
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 #ifndef INCLUDED_XMLSECURITY_SOURCE_GPG_X509CERTIFICATE_HXX
11 #define INCLUDED_XMLSECURITY_SOURCE_GPG_X509CERTIFICATE_HXX
13 #include <certificate.hxx>
15 #include <sal/types.h>
16 #include <sal/config.h>
17 #include <rtl/ustring.hxx>
18 #include <cppuhelper/implbase.hxx>
20 #include <com/sun/star/uno/Sequence.hxx>
21 #include <com/sun/star/lang/XServiceInfo.hpp>
22 #include <com/sun/star/lang/XUnoTunnel.hpp>
23 #include <com/sun/star/security/CertificateKind.hpp>
24 #include <com/sun/star/security/XCertificate.hpp>
26 #if defined _MSC_VER && defined __clang__
27 #pragma clang diagnostic push
28 #pragma clang diagnostic ignored "-Wundef"
29 #endif
30 #include <key.h>
31 #if defined _MSC_VER && defined __clang__
32 #pragma clang diagnostic pop
33 #endif
35 class CertificateImpl : public cppu::WeakImplHelper< css::security::XCertificate,
36 css::lang::XUnoTunnel,
37 css::lang::XServiceInfo >,
38 public xmlsecurity::Certificate
40 private:
41 GpgME::Key m_pKey;
42 css::uno::Sequence< sal_Int8 > m_aBits;
44 public:
45 CertificateImpl();
46 virtual ~CertificateImpl() override;
48 //Methods from XCertificate
49 virtual sal_Int16 SAL_CALL getVersion() override;
51 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber() override;
53 virtual OUString SAL_CALL getIssuerName() override;
54 virtual OUString SAL_CALL getSubjectName() override;
56 virtual css::util::DateTime SAL_CALL getNotValidBefore() override;
57 virtual css::util::DateTime SAL_CALL getNotValidAfter() override;
59 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID() override;
60 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID() override;
62 virtual css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension > > SAL_CALL getExtensions() override;
64 virtual css::uno::Reference< css::security::XCertificateExtension > SAL_CALL findCertificateExtension(const css::uno::Sequence< sal_Int8 >& oid) override;
66 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getEncoded() override;
68 virtual OUString SAL_CALL getSubjectPublicKeyAlgorithm() override;
70 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue() override;
72 virtual OUString SAL_CALL getSignatureAlgorithm() override;
74 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint() override;
76 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint() override;
78 virtual sal_Int32 SAL_CALL getCertificateUsage() override;
80 //Methods from XUnoTunnel
81 virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& aIdentifier) override;
83 static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
85 /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
86 virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override;
87 /// @see xmlsecurity::Certificate::getSignatureMethodAlgorithm().
88 virtual svl::crypto::SignatureMethodAlgorithm getSignatureMethodAlgorithm() override;
89 virtual css::security::CertificateKind SAL_CALL getCertificateKind() override;
91 // Helper methods
92 void setCertificate(GpgME::Context* ctx, const GpgME::Key& key);
93 const GpgME::Key* getCertificate() const;
95 // XServiceInfo
96 virtual OUString SAL_CALL getImplementationName() override;
97 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
98 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
99 } ;
101 #endif // INCLUDED_XMLSECURITY_SOURCE_GPG_X509CERTIFICATE_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */