Bump version to 6.0-36
[LibreOffice.git] / xmlsecurity / source / gpg / CertificateImpl.hxx
blobeaf81bd3f37f301a58b40c3ea5ecad2c323eda5f
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/factory.hxx>
19 #include <cppuhelper/implbase.hxx>
21 #include <com/sun/star/uno/Exception.hpp>
22 #include <com/sun/star/uno/RuntimeException.hpp>
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
26 #include <com/sun/star/uno/SecurityException.hpp>
27 #include <com/sun/star/security/CertificateKind.hpp>
28 #include <com/sun/star/security/XCertificate.hpp>
30 #include <key.h>
32 class CertificateImpl : public cppu::WeakImplHelper< css::security::XCertificate,
33 css::lang::XUnoTunnel,
34 css::lang::XServiceInfo >,
35 public xmlsecurity::Certificate
37 private:
38 GpgME::Key m_pKey;
39 css::uno::Sequence< sal_Int8 > m_aBits;
41 public:
42 CertificateImpl();
43 virtual ~CertificateImpl() override;
45 //Methods from XCertificate
46 virtual sal_Int16 SAL_CALL getVersion() override;
48 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber() override;
50 virtual OUString SAL_CALL getIssuerName() override;
51 virtual OUString SAL_CALL getSubjectName() override;
53 virtual css::util::DateTime SAL_CALL getNotValidBefore() override;
54 virtual css::util::DateTime SAL_CALL getNotValidAfter() override;
56 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID() override;
57 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID() override;
59 virtual css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension > > SAL_CALL getExtensions() override;
61 virtual css::uno::Reference< css::security::XCertificateExtension > SAL_CALL findCertificateExtension(const css::uno::Sequence< sal_Int8 >& oid) override;
63 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getEncoded() override;
65 virtual OUString SAL_CALL getSubjectPublicKeyAlgorithm() override;
67 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue() override;
69 virtual OUString SAL_CALL getSignatureAlgorithm() override;
71 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint() override;
73 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint() override;
75 virtual sal_Int32 SAL_CALL getCertificateUsage() override;
77 //Methods from XUnoTunnel
78 virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& aIdentifier) override;
80 static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
82 /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
83 virtual css::uno::Sequence<sal_Int8> SAL_CALL getSHA256Thumbprint() override;
84 virtual css::security::CertificateKind SAL_CALL getCertificateKind() override;
86 // Helper methods
87 void setCertificate(GpgME::Context* ctx, const GpgME::Key& key);
88 const GpgME::Key* getCertificate() const;
90 // XServiceInfo
91 virtual OUString SAL_CALL getImplementationName() override;
92 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
93 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
94 } ;
96 #endif // INCLUDED_XMLSECURITY_SOURCE_GPG_X509CERTIFICATE_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */