1*06b3ce53SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*06b3ce53SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*06b3ce53SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*06b3ce53SAndrew Rist * distributed with this work for additional information 6*06b3ce53SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*06b3ce53SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*06b3ce53SAndrew Rist * "License"); you may not use this file except in compliance 9*06b3ce53SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*06b3ce53SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*06b3ce53SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*06b3ce53SAndrew Rist * software distributed under the License is distributed on an 15*06b3ce53SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*06b3ce53SAndrew Rist * KIND, either express or implied. See the License for the 17*06b3ce53SAndrew Rist * specific language governing permissions and limitations 18*06b3ce53SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*06b3ce53SAndrew Rist *************************************************************/ 21*06b3ce53SAndrew Rist 22*06b3ce53SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_xmlsecurity.hxx" 26cdf0e10cSrcweir #include <sal/config.h> 27cdf0e10cSrcweir #include <rtl/uuid.h> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #ifndef _certificateextension_nssimpl_hxx_ 30cdf0e10cSrcweir #include "certificateextension_xmlsecimpl.hxx" 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir 33cdf0e10cSrcweir using namespace ::com::sun::star::uno ; 34cdf0e10cSrcweir using ::rtl::OUString ; 35cdf0e10cSrcweir 36cdf0e10cSrcweir using ::com::sun::star::security::XCertificateExtension ; 37cdf0e10cSrcweir 38cdf0e10cSrcweir CertificateExtension_XmlSecImpl :: CertificateExtension_XmlSecImpl() : 39cdf0e10cSrcweir m_critical( sal_False ) , 40cdf0e10cSrcweir m_xExtnId() , 41cdf0e10cSrcweir m_xExtnValue() 42cdf0e10cSrcweir { 43cdf0e10cSrcweir } 44cdf0e10cSrcweir 45cdf0e10cSrcweir CertificateExtension_XmlSecImpl :: ~CertificateExtension_XmlSecImpl() { 46cdf0e10cSrcweir } 47cdf0e10cSrcweir 48cdf0e10cSrcweir 49cdf0e10cSrcweir //Methods from XCertificateExtension 50cdf0e10cSrcweir sal_Bool SAL_CALL CertificateExtension_XmlSecImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) { 51cdf0e10cSrcweir return m_critical ; 52cdf0e10cSrcweir } 53cdf0e10cSrcweir 54cdf0e10cSrcweir ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) { 55cdf0e10cSrcweir return m_xExtnId ; 56cdf0e10cSrcweir } 57cdf0e10cSrcweir 58cdf0e10cSrcweir ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) { 59cdf0e10cSrcweir return m_xExtnValue ; 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir //Helper method 63cdf0e10cSrcweir void CertificateExtension_XmlSecImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) { 64cdf0e10cSrcweir m_critical = critical ; 65cdf0e10cSrcweir m_xExtnId = extnId ; 66cdf0e10cSrcweir m_xExtnValue = extnValue ; 67cdf0e10cSrcweir } 68cdf0e10cSrcweir 69cdf0e10cSrcweir void CertificateExtension_XmlSecImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) { 70cdf0e10cSrcweir unsigned int i ; 71cdf0e10cSrcweir if( value != NULL && vlen != 0 ) { 72cdf0e10cSrcweir Sequence< sal_Int8 > extnv( vlen ) ; 73cdf0e10cSrcweir for( i = 0; i < vlen ; i ++ ) 74cdf0e10cSrcweir extnv[i] = *( value + i ) ; 75cdf0e10cSrcweir 76cdf0e10cSrcweir m_xExtnValue = extnv ; 77cdf0e10cSrcweir } else { 78cdf0e10cSrcweir m_xExtnValue = Sequence<sal_Int8>(); 79cdf0e10cSrcweir } 80cdf0e10cSrcweir 81cdf0e10cSrcweir if( id != NULL && idlen != 0 ) { 82cdf0e10cSrcweir Sequence< sal_Int8 > extnId( idlen ) ; 83cdf0e10cSrcweir for( i = 0; i < idlen ; i ++ ) 84cdf0e10cSrcweir extnId[i] = *( id + i ) ; 85cdf0e10cSrcweir 86cdf0e10cSrcweir m_xExtnId = extnId ; 87cdf0e10cSrcweir } else { 88cdf0e10cSrcweir m_xExtnId = Sequence<sal_Int8>(); 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91cdf0e10cSrcweir m_critical = critical ; 92cdf0e10cSrcweir } 93cdf0e10cSrcweir 94