Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / xmlsecurity / source / xmlsec / nss / x509certificate_nssimpl.hxx
blob35cd393f203413764e217cd6e07c8a88662629c4
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_XMLSECURITY_SOURCE_XMLSEC_NSS_X509CERTIFICATE_NSSIMPL_HXX
21 #define INCLUDED_XMLSECURITY_SOURCE_XMLSEC_NSS_X509CERTIFICATE_NSSIMPL_HXX
23 #include <sal/config.h>
24 #include <rtl/ustring.hxx>
25 #include <cppuhelper/implbase.hxx>
26 #include <com/sun/star/lang/XUnoTunnel.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/security/CertificateKind.hpp>
29 #include <com/sun/star/security/XCertificate.hpp>
31 #include <certificate.hxx>
32 #include <certt.h>
33 #include <keythi.h>
35 class X509Certificate_NssImpl : public ::cppu::WeakImplHelper<
36 css::security::XCertificate ,
37 css::lang::XUnoTunnel,
38 css::lang::XServiceInfo > , public xmlsecurity::Certificate
40 private:
41 CERTCertificate* m_pCert;
43 public:
44 X509Certificate_NssImpl() ;
45 virtual ~X509Certificate_NssImpl() override ;
47 //Methods from XCertificate
48 virtual sal_Int16 SAL_CALL getVersion( ) override ;
50 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber( ) override ;
52 virtual OUString SAL_CALL getIssuerName( ) override ;
53 virtual OUString SAL_CALL getSubjectName( ) override ;
55 virtual css::util::DateTime SAL_CALL getNotValidBefore( ) override ;
56 virtual css::util::DateTime SAL_CALL getNotValidAfter( ) override ;
58 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID( ) override ;
59 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID( ) override ;
61 virtual css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension > > SAL_CALL getExtensions( ) override ;
63 virtual css::uno::Reference< css::security::XCertificateExtension > SAL_CALL findCertificateExtension( const css::uno::Sequence< sal_Int8 >& oid ) override ;
65 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getEncoded( ) override ;
67 virtual OUString SAL_CALL getSubjectPublicKeyAlgorithm() override ;
69 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue() override ;
71 virtual OUString SAL_CALL getSignatureAlgorithm() override ;
73 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint() override ;
75 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint() override ;
76 virtual css::security::CertificateKind SAL_CALL getCertificateKind() 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 /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
84 virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override;
86 /// @see xmlsecurity::Certificate::getSignatureMethodAlgorithm().
87 virtual svl::crypto::SignatureMethodAlgorithm getSignatureMethodAlgorithm() override;
89 static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
91 //Helper methods
92 void setCert( CERTCertificate* cert ) ;
93 const CERTCertificate* getNssCert() const ;
95 /// @throws css::uno::RuntimeException
96 void setRawCert( const css::uno::Sequence< sal_Int8 >& rawCert ) ;
97 SECKEYPrivateKey* getPrivateKey();
99 // XServiceInfo
100 virtual OUString SAL_CALL getImplementationName() override;
101 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
102 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
105 #endif // INCLUDED_XMLSECURITY_SOURCE_XMLSEC_NSS_X509CERTIFICATE_NSSIMPL_HXX
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */