Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <sal/config.h>
21 : #include <rtl/uuid.h>
22 :
23 : #include "certificateextension_xmlsecimpl.hxx"
24 :
25 : using namespace ::com::sun::star::uno ;
26 :
27 : using ::com::sun::star::security::XCertificateExtension ;
28 :
29 0 : CertificateExtension_XmlSecImpl :: CertificateExtension_XmlSecImpl() :
30 : m_critical( false ) ,
31 : m_xExtnId() ,
32 0 : m_xExtnValue()
33 : {
34 0 : }
35 :
36 0 : CertificateExtension_XmlSecImpl :: ~CertificateExtension_XmlSecImpl() {
37 0 : }
38 :
39 :
40 : //Methods from XCertificateExtension
41 0 : sal_Bool SAL_CALL CertificateExtension_XmlSecImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException, std::exception ) {
42 0 : return m_critical ;
43 : }
44 :
45 0 : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException, std::exception ) {
46 0 : return m_xExtnId ;
47 : }
48 :
49 0 : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CertificateExtension_XmlSecImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException, std::exception ) {
50 0 : return m_xExtnValue ;
51 : }
52 :
53 0 : void CertificateExtension_XmlSecImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, bool critical ) {
54 : unsigned int i ;
55 0 : if( value != NULL && vlen != 0 ) {
56 0 : Sequence< sal_Int8 > extnv( vlen ) ;
57 0 : for( i = 0; i < vlen ; i ++ )
58 0 : extnv[i] = *( value + i ) ;
59 :
60 0 : m_xExtnValue = extnv ;
61 : } else {
62 0 : m_xExtnValue = Sequence<sal_Int8>();
63 : }
64 :
65 0 : if( id != NULL && idlen != 0 ) {
66 0 : Sequence< sal_Int8 > extnId( idlen ) ;
67 0 : for( i = 0; i < idlen ; i ++ )
68 0 : extnId[i] = *( id + i ) ;
69 :
70 0 : m_xExtnId = extnId ;
71 : } else {
72 0 : m_xExtnId = Sequence<sal_Int8>();
73 : }
74 :
75 0 : m_critical = critical ;
76 0 : }
77 :
78 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|