1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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>
33 class X509Certificate_NssImpl
: public ::cppu::WeakImplHelper
<
34 css::security::XCertificate
,
35 css::lang::XServiceInfo
> , public xmlsecurity::Certificate
38 CERTCertificate
* m_pCert
;
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
;
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();
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
;
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */