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 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_xmlsecurity.hxx" 26 #include <sal/config.h> 27 #include <rtl/uuid.h> 28 29 #ifndef _certificateextension_nssimpl_hxx_ 30 #include "certificateextension_xmlsecimpl.hxx" 31 #endif 32 33 using namespace ::com::sun::star::uno ; 34 using ::rtl::OUString ; 35 36 using ::com::sun::star::security::XCertificateExtension ; 37 38 CertificateExtension_XmlSecImpl :: CertificateExtension_XmlSecImpl() : 39 m_critical( sal_False ) , 40 m_xExtnId() , 41 m_xExtnValue() 42 { 43 } 44 45 CertificateExtension_XmlSecImpl :: ~CertificateExtension_XmlSecImpl() { 46 } 47 48 49 //Methods from XCertificateExtension 50 sal_Bool SAL_CALL CertificateExtension_XmlSecImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) { 51 return m_critical ; 52 } 53 54 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) { 55 return m_xExtnId ; 56 } 57 58 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) { 59 return m_xExtnValue ; 60 } 61 62 //Helper method 63 void CertificateExtension_XmlSecImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) { 64 m_critical = critical ; 65 m_xExtnId = extnId ; 66 m_xExtnValue = extnValue ; 67 } 68 69 void CertificateExtension_XmlSecImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) { 70 unsigned int i ; 71 if( value != NULL && vlen != 0 ) { 72 Sequence< sal_Int8 > extnv( vlen ) ; 73 for( i = 0; i < vlen ; i ++ ) 74 extnv[i] = *( value + i ) ; 75 76 m_xExtnValue = extnv ; 77 } else { 78 m_xExtnValue = Sequence<sal_Int8>(); 79 } 80 81 if( id != NULL && idlen != 0 ) { 82 Sequence< sal_Int8 > extnId( idlen ) ; 83 for( i = 0; i < idlen ; i ++ ) 84 extnId[i] = *( id + i ) ; 85 86 m_xExtnId = extnId ; 87 } else { 88 m_xExtnId = Sequence<sal_Int8>(); 89 } 90 91 m_critical = critical ; 92 } 93 94