/usr/include/xsec/utils/XSECDOMUtils.hpp is in libxml-security-c-dev 1.7.2-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* XSEC
*
* XSECDOMUtils:= Utilities to manipulate DOM within XML-SECURITY
*
* Author(s): Berin Lautenbach
*
* $Id: XSECDOMUtils.hpp 1350044 2012-06-13 22:31:37Z scantor $
*
*/
#ifndef XSECDOMUTILS_HEADER
#define XSECDOMUTILS_HEADER
// XSEC
#include <xsec/utils/XSECPlatformUtils.hpp>
#include <xsec/utils/XSECSafeBuffer.hpp>
#include <xsec/dsig/DSIGConstants.hpp>
// Xerces
#include <xercesc/dom/DOM.hpp>
#include <xercesc/util/XMLString.hpp>
#define COMPARE_STRING_LENGTH 256
// --------------------------------------------------------------------------------
// "Quick" Transcode Class (low performance)
// --------------------------------------------------------------------------------
class DSIG_EXPORT XMLT {
public:
XMLT(const char * str);
~XMLT(void);
XMLCh * getUnicodeStr(void);
private:
XMLCh * mp_unicodeStr;
XMLT();
};
#define MAKE_UNICODE_STRING(str) XMLT(str).getUnicodeStr()
// --------------------------------------------------------------------------------
// Utilities to manipulate namespaces
// --------------------------------------------------------------------------------
const XMLCh DSIG_EXPORT * getDSIGLocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
const XMLCh DSIG_EXPORT * getDSIG11LocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
const XMLCh DSIG_EXPORT * getECLocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
const XMLCh DSIG_EXPORT * getXPFLocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
const XMLCh DSIG_EXPORT * getXENCLocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
const XMLCh DSIG_EXPORT * getXENC11LocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
const XMLCh DSIG_EXPORT * getXKMSLocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
// --------------------------------------------------------------------------------
// Do UTF-8 <-> UTF-16 transcoding
// --------------------------------------------------------------------------------
XMLCh DSIG_EXPORT * transcodeFromUTF8(const unsigned char * src);
char DSIG_EXPORT * transcodeToUTF8(const XMLCh * src);
// --------------------------------------------------------------------------------
// Find a nominated DSIG/XENC node in a document
// --------------------------------------------------------------------------------
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode DSIG_EXPORT * findDSIGNode(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *n, const char * nodeName);
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode DSIG_EXPORT * findXENCNode(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *n, const char * nodeName);
// --------------------------------------------------------------------------------
// Find particular type of node child
// --------------------------------------------------------------------------------
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode DSIG_EXPORT * findFirstChildOfType(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *n, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode::NodeType t);
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode DSIG_EXPORT * findNextChildOfType(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *n, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode::NodeType t);
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement DSIG_EXPORT * findFirstElementChild(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *n);
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement DSIG_EXPORT * findNextElementChild(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *n);
// --------------------------------------------------------------------------------
// Make a QName
// --------------------------------------------------------------------------------
safeBuffer DSIG_EXPORT &makeQName(safeBuffer & qname, safeBuffer &prefix, const char * localName);
safeBuffer DSIG_EXPORT &makeQName(safeBuffer & qname, const XMLCh *prefix, const char * localName);
safeBuffer DSIG_EXPORT &makeQName(safeBuffer & qname, const XMLCh *prefix, const XMLCh * localName);
// --------------------------------------------------------------------------------
// Gather text from children
// --------------------------------------------------------------------------------
void DSIG_EXPORT gatherChildrenText(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * parent, safeBuffer &output);
// --------------------------------------------------------------------------------
// String decode/encode
// --------------------------------------------------------------------------------
/*
* Distinguished names have a particular encoding that needs to be performed prior
* to enclusion in the DOM
*/
XMLCh * encodeDName(const XMLCh * toEncode);
XMLCh * decodeDName(const XMLCh * toDecode);
// --------------------------------------------------------------------------------
// Generate Ids
// --------------------------------------------------------------------------------
XMLCh DSIG_EXPORT * generateId(unsigned int bytes = 16);
// --------------------------------------------------------------------------------
// String Functions
// --------------------------------------------------------------------------------
// Remove escape (%XX) characters from URIs and return a new buffer containing the
// "cleaned" string
XMLCh * cleanURIEscapes(const XMLCh * str);
inline
bool strEquals (const XMLCh * str1, const XMLCh *str2) {
return (XMLString::compareString(str1, str2) == 0);
}
inline
bool strEquals (const char * str1, const char *str2) {
return (XMLString::compareString(str1, str2) == 0);
}
inline
bool strEquals (const char * str1, const XMLCh * str2) {
bool ret;
XMLCh * str1XMLCh = XMLString::transcode(str1);
if (str1XMLCh != NULL) {
ret = (XMLString::compareString(str1XMLCh, str2) == 0);
XSEC_RELEASE_XMLCH(str1XMLCh);
}
else
ret = false;
return ret;
}
inline
bool strEquals (const XMLCh * str1, const char * str2) {
bool ret;
XMLCh * str2XMLCh = XMLString::transcode(str2);
if (str2XMLCh != NULL) {
ret = (XMLString::compareString(str1, str2XMLCh) == 0);
XSEC_RELEASE_XMLCH(str2XMLCh);
}
else
ret = false;
return ret;
}
#endif /* XSECDOMUTILS_HEADER */
|