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