xref: /AOO41X/main/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx (revision ec61c6ed669d81c7df08233ccc38d0040f129ece)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _X509CERTIFICATE_NSSIMPL_HXX_
25 #define _X509CERTIFICATE_NSSIMPL_HXX_
26 
27 #include <sal/config.h>
28 #include <rtl/ustring.hxx>
29 #include <cppuhelper/factory.hxx>
30 #include <cppuhelper/implbase2.hxx>
31 #include <com/sun/star/uno/Exception.hpp>
32 #include <com/sun/star/lang/XUnoTunnel.hpp>
33 #include "com/sun/star/uno/SecurityException.hpp"
34 #include <com/sun/star/security/XCertificate.hpp>
35 
36 #include "cert.h"
37 
38 class X509Certificate_NssImpl : public ::cppu::WeakImplHelper2<
39     ::com::sun::star::security::XCertificate ,
40     ::com::sun::star::lang::XUnoTunnel >
41 {
42     private :
43         CERTCertificate* m_pCert ;
44 
45     public :
46         X509Certificate_NssImpl() ;
47         virtual ~X509Certificate_NssImpl() ;
48 
49         //Methods from XCertificate
50         virtual sal_Int16 SAL_CALL getVersion(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
51 
52         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSerialNumber(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
53 
54         virtual ::rtl::OUString SAL_CALL getIssuerName(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
55 
56         virtual ::rtl::OUString SAL_CALL getSubjectName(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
57 
58         virtual ::com::sun::star::util::DateTime SAL_CALL getNotValidBefore(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
59 
60         virtual ::com::sun::star::util::DateTime SAL_CALL getNotValidAfter(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
61 
62         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getIssuerUniqueID(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
63 
64         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSubjectUniqueID(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
65 
66         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificateExtension > > SAL_CALL getExtensions(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
67 
68         virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificateExtension > SAL_CALL findCertificateExtension( const ::com::sun::star::uno::Sequence< sal_Int8 >& oid ) throw (::com::sun::star::uno::RuntimeException) ;
69 
70         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getEncoded(  ) throw ( ::com::sun::star::uno::RuntimeException) ;
71 
72         // MM : added by MM
73         virtual ::rtl::OUString SAL_CALL getSubjectPublicKeyAlgorithm()
74             throw ( ::com::sun::star::uno::RuntimeException) ;
75 
76         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue()
77             throw ( ::com::sun::star::uno::RuntimeException) ;
78 
79         virtual ::rtl::OUString SAL_CALL getSignatureAlgorithm()
80             throw ( ::com::sun::star::uno::RuntimeException) ;
81 
82         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSHA1Thumbprint()
83             throw ( ::com::sun::star::uno::RuntimeException) ;
84 
85         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getMD5Thumbprint()
86             throw ( ::com::sun::star::uno::RuntimeException) ;
87 
88         virtual sal_Int32 SAL_CALL getCertificateUsage( ) throw ( ::com::sun::star::uno::RuntimeException) ;
89         // MM : end
90 
91         //Methods from XUnoTunnel
92         virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (com::sun::star::uno::RuntimeException);
93 
94         static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
95         static X509Certificate_NssImpl* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj ) ;
96 
97         //Helper methods
98         void setCert( CERTCertificate* cert ) ;
99         const CERTCertificate* getNssCert() const ;
100         void setRawCert( ::com::sun::star::uno::Sequence< sal_Int8 > rawCert ) throw ( ::com::sun::star::uno::RuntimeException) ;
101 } ;
102 
103 #endif  // _X509CERTIFICATE_NSSIMPL_HXX_
104 
105