merged tag ooo/OOO330_m14
[LibreOffice.git] / xmlsecurity / source / xmlsec / certificateextension_xmlsecimpl.cxx
blob19dfeb9c08a7897e9366bcab257a2cc874d9be24
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
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>
33 #ifndef _certificateextension_nssimpl_hxx_
34 #include "certificateextension_xmlsecimpl.hxx"
35 #endif
37 using namespace ::com::sun::star::uno ;
38 using ::rtl::OUString ;
40 using ::com::sun::star::security::XCertificateExtension ;
42 CertificateExtension_XmlSecImpl :: CertificateExtension_XmlSecImpl() :
43 m_critical( sal_False ) ,
44 m_xExtnId() ,
45 m_xExtnValue()
49 CertificateExtension_XmlSecImpl :: ~CertificateExtension_XmlSecImpl() {
53 //Methods from XCertificateExtension
54 sal_Bool SAL_CALL CertificateExtension_XmlSecImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) {
55 return m_critical ;
58 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) {
59 return m_xExtnId ;
62 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) {
63 return m_xExtnValue ;
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 ;
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 ) ;
80 m_xExtnValue = extnv ;
81 } else {
82 m_xExtnValue = Sequence<sal_Int8>();
85 if( id != NULL && idlen != 0 ) {
86 Sequence< sal_Int8 > extnId( idlen ) ;
87 for( i = 0; i < idlen ; i ++ )
88 extnId[i] = *( id + i ) ;
90 m_xExtnId = extnId ;
91 } else {
92 m_xExtnId = Sequence<sal_Int8>();
95 m_critical = critical ;