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 #if !defined WIN32_LEAN_AND_MEAN
23 # define WIN32_LEAN_AND_MEAN
27 #include <sal/config.h>
28 #include <rtl/ustring.hxx>
29 #include <cppuhelper/factory.hxx>
30 #include <cppuhelper/implbase.hxx>
31 #include <comphelper/servicehelper.hxx>
32 #include <com/sun/star/uno/Exception.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/uno/SecurityException.hpp>
35 #include <com/sun/star/security/CertificateKind.hpp>
36 #include <com/sun/star/security/XCertificate.hpp>
37 #include <certificate.hxx>
39 class X509Certificate_MSCryptImpl
: public ::cppu::WeakImplHelper
<
40 css::security::XCertificate
,
41 css::lang::XServiceInfo
> , public xmlsecurity::Certificate
44 const CERT_CONTEXT
* m_pCertContext
;
47 X509Certificate_MSCryptImpl() ;
48 virtual ~X509Certificate_MSCryptImpl() override
;
50 //Methods from XCertificate
51 virtual sal_Int16 SAL_CALL
getVersion() override
;
53 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getSerialNumber() override
;
54 virtual OUString SAL_CALL
getIssuerName() override
;
55 virtual OUString SAL_CALL
getSubjectName() override
;
56 virtual css::util::DateTime SAL_CALL
getNotValidBefore() override
;
57 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
;
60 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
;
62 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getEncoded() override
;
63 virtual OUString SAL_CALL
getSubjectPublicKeyAlgorithm() override
;
64 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getSubjectPublicKeyValue() override
;
65 virtual OUString SAL_CALL
getSignatureAlgorithm() override
;
66 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getSHA1Thumbprint() override
;
67 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getMD5Thumbprint() override
;
68 virtual css::security::CertificateKind SAL_CALL
getCertificateKind() override
;
71 virtual sal_Int32 SAL_CALL
getCertificateUsage( ) override
;
73 /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
74 virtual css::uno::Sequence
<sal_Int8
> getSHA256Thumbprint() override
;
76 /// @see xmlsecurity::Certificate::getSignatureMethodAlgorithm().
77 virtual svl::crypto::SignatureMethodAlgorithm
getSignatureMethodAlgorithm() override
;
80 void setMswcryCert( const CERT_CONTEXT
* cert
) ;
81 const CERT_CONTEXT
* getMswcryCert() const ;
82 /// @throws css::uno::RuntimeException
83 void setRawCert( css::uno::Sequence
< sal_Int8
> const & rawCert
) ;
86 virtual OUString SAL_CALL
getImplementationName() override
;
87 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
88 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */