cid#1640468 Dereference after null check
[LibreOffice.git] / xmlsecurity / source / xmlsec / nss / x509certificate_nssimpl.hxx
blob9ad50f12ba0ff2653bcdb71514bb48604c6d6408
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 #pragma once
22 #include <sal/config.h>
23 #include <rtl/ustring.hxx>
24 #include <cppuhelper/implbase.hxx>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/security/CertificateKind.hpp>
27 #include <com/sun/star/security/XCertificate.hpp>
29 #include <certificate.hxx>
30 #include <certt.h>
31 #include <keythi.h>
33 class X509Certificate_NssImpl : public ::cppu::WeakImplHelper<
34 css::security::XCertificate ,
35 css::lang::XServiceInfo > , public xmlsecurity::Certificate
37 private:
38 CERTCertificate* m_pCert;
40 public:
41 X509Certificate_NssImpl() ;
42 virtual ~X509Certificate_NssImpl() override ;
44 //Methods from XCertificate
45 virtual sal_Int16 SAL_CALL getVersion( ) override ;
47 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber( ) override ;
49 virtual OUString SAL_CALL getIssuerName( ) override ;
50 virtual OUString SAL_CALL getSubjectName( ) override ;
52 virtual css::util::DateTime SAL_CALL getNotValidBefore( ) override ;
53 virtual css::util::DateTime SAL_CALL getNotValidAfter( ) override ;
55 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID( ) override ;
56 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID( ) override ;
58 virtual css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension > > SAL_CALL getExtensions( ) override ;
60 virtual css::uno::Reference< css::security::XCertificateExtension > SAL_CALL findCertificateExtension( const css::uno::Sequence< sal_Int8 >& oid ) override ;
62 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getEncoded( ) override ;
64 virtual OUString SAL_CALL getSubjectPublicKeyAlgorithm() override ;
66 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue() override ;
68 virtual OUString SAL_CALL getSignatureAlgorithm() override ;
70 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint() override ;
72 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint() override ;
73 virtual css::security::CertificateKind SAL_CALL getCertificateKind() override;
75 virtual sal_Int32 SAL_CALL getCertificateUsage( ) override ;
77 /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
78 virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override;
80 /// @see xmlsecurity::Certificate::getSignatureMethodAlgorithm().
81 virtual svl::crypto::SignatureMethodAlgorithm getSignatureMethodAlgorithm() override;
83 //Helper methods
84 void setCert( CERTCertificate* cert ) ;
85 const CERTCertificate* getNssCert() const ;
87 /// @throws css::uno::RuntimeException
88 void setRawCert( const css::uno::Sequence< sal_Int8 >& rawCert ) ;
89 SECKEYPrivateKey* getPrivateKey();
91 // XServiceInfo
92 virtual OUString SAL_CALL getImplementationName() override;
93 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
94 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
95 } ;
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */