1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_xmlsecurity.hxx" 30 #include <sal/config.h> 31 #include <rtl/uuid.h> 32 33 #ifndef _certificateextension_nssimpl_hxx_ 34 #include "certificateextension_xmlsecimpl.hxx" 35 #endif 36 37 using namespace ::com::sun::star::uno ; 38 using ::rtl::OUString ; 39 40 using ::com::sun::star::security::XCertificateExtension ; 41 42 CertificateExtension_XmlSecImpl :: CertificateExtension_XmlSecImpl() : 43 m_critical( sal_False ) , 44 m_xExtnId() , 45 m_xExtnValue() 46 { 47 } 48 49 CertificateExtension_XmlSecImpl :: ~CertificateExtension_XmlSecImpl() { 50 } 51 52 53 //Methods from XCertificateExtension 54 sal_Bool SAL_CALL CertificateExtension_XmlSecImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) { 55 return m_critical ; 56 } 57 58 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) { 59 return m_xExtnId ; 60 } 61 62 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) { 63 return m_xExtnValue ; 64 } 65 66 //Helper method 67 void CertificateExtension_XmlSecImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) { 68 m_critical = critical ; 69 m_xExtnId = extnId ; 70 m_xExtnValue = extnValue ; 71 } 72 73 void CertificateExtension_XmlSecImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) { 74 unsigned int i ; 75 if( value != NULL && vlen != 0 ) { 76 Sequence< sal_Int8 > extnv( vlen ) ; 77 for( i = 0; i < vlen ; i ++ ) 78 extnv[i] = *( value + i ) ; 79 80 m_xExtnValue = extnv ; 81 } else { 82 m_xExtnValue = Sequence<sal_Int8>(); 83 } 84 85 if( id != NULL && idlen != 0 ) { 86 Sequence< sal_Int8 > extnId( idlen ) ; 87 for( i = 0; i < idlen ; i ++ ) 88 extnId[i] = *( id + i ) ; 89 90 m_xExtnId = extnId ; 91 } else { 92 m_xExtnId = Sequence<sal_Int8>(); 93 } 94 95 m_critical = critical ; 96 } 97 98