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