File: XKMSKeyBindingAbstractTypeImpl.hpp

package info (click to toggle)
xml-security-c 1.7.3-4%2Bdeb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,096 kB
  • sloc: cpp: 47,259; sh: 4,123; makefile: 503
file content (205 lines) | stat: -rw-r--r-- 7,450 bytes parent folder | download | duplicates (6)
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
200
201
202
203
204
205
/**
 * 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
 *
 * XKMSKeyBindingAbstractTypeImpl := Implementation of base for KeyBinding elements
 *
 * $Id: XKMSKeyBindingAbstractTypeImpl.hpp 1125514 2011-05-20 19:08:33Z scantor $
 *
 */

#ifndef XKMSKEYBINDINGABSTRACTTYPEIMPL_INCLUDE
#define XKMSKEYBINDINGABSTRACTTYPEIMPL_INCLUDE

// XSEC Includes

#include <xsec/framework/XSECDefs.hpp>
#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>

#include <vector>

XSEC_DECLARE_XERCES_CLASS(DOMNode);

class XSECEnv;
class DSIGKeyInfoList;
class XKMSUseKeyWithImpl;

class XKMSKeyBindingAbstractTypeImpl : public XKMSKeyBindingAbstractType {

public:

	/* Constructors and Destructors */

	XKMSKeyBindingAbstractTypeImpl(
		const XSECEnv * env
	);

	XKMSKeyBindingAbstractTypeImpl(
		const XSECEnv * env, 
		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
	);

	virtual ~XKMSKeyBindingAbstractTypeImpl() ;

	// Load
	void load(void);

	// Create
	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
		createBlankKeyBindingAbstractType(const XMLCh * tag);

	/* Getter Interface Methods */

	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const;

	virtual const XMLCh * getId(void) const;
	virtual DSIGKeyInfoList * getKeyInfoList(void) const;
	virtual bool getEncryptionKeyUsage(void) const;
	virtual bool getSignatureKeyUsage(void) const;
	virtual bool getExchangeKeyUsage(void) const;

	/* Setter interface methods */

	virtual void setId(const XMLCh * id = NULL);
	virtual void setEncryptionKeyUsage(void);
	virtual void setSignatureKeyUsage(void);
	virtual void setExchangeKeyUsage(void);

	/* Key Info methods */
	virtual DSIGKeyInfoList * getKeyInfoList();
	virtual void clearKeyInfo(void);
	virtual DSIGKeyInfoValue * appendDSAKeyValue(const XMLCh * P, 
						   const XMLCh * Q, 
						   const XMLCh * G, 
						   const XMLCh * Y);
	virtual DSIGKeyInfoValue * appendRSAKeyValue(const XMLCh * modulus, 
						   const XMLCh * exponent);
	virtual DSIGKeyInfoX509 * appendX509Data(void);
	virtual DSIGKeyInfoName * appendKeyName(const XMLCh * name, bool isDName = false);
	virtual DSIGKeyInfoPGPData * appendPGPData(const XMLCh * id, const XMLCh * packet);
	virtual DSIGKeyInfoSPKIData * appendSPKIData(const XMLCh * sexp);
	virtual DSIGKeyInfoMgmtData * appendMgmtData(const XMLCh * data);

	/* UseKeyWith handling */

	virtual int getUseKeyWithSize(void) const;
	virtual XKMSUseKeyWith * getUseKeyWithItem(int item) const;
	virtual XKMSUseKeyWith * appendUseKeyWithItem(
			const XMLCh * application,  
			const XMLCh * identifier);

protected:

	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
					* mp_keyBindingAbstractTypeElement;
	const XSECEnv	* mp_env;

private:

	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
		setKeyUsage(const XMLCh * usage);

#if defined(XSEC_NO_NAMESPACES)
	typedef vector<XKMSUseKeyWithImpl *>		UseKeyWithVectorType;
#else
	typedef std::vector<XKMSUseKeyWithImpl *>	UseKeyWithVectorType;
#endif

	UseKeyWithVectorType	m_useKeyWithList;
	
	XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
					* mp_idAttr;
	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
					* mp_keyUsageSignatureElement;
	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
					* mp_keyUsageEncryptionElement;
	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
					* mp_keyUsageExchangeElement;
	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
					* mp_keyInfoElement;
	DSIGKeyInfoList * mp_keyInfoList;

	void createKeyInfoElement(void);

	// Unimplemented
	XKMSKeyBindingAbstractTypeImpl(void);
	XKMSKeyBindingAbstractTypeImpl(const XKMSKeyBindingAbstractTypeImpl &);
	XKMSKeyBindingAbstractTypeImpl & operator = (const XKMSKeyBindingAbstractTypeImpl &);

};

// Define imported methods for classes that inherit them (makes things easier)

#define XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS \
	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const \
		{return XKMSKeyBindingAbstractTypeImpl::getElement();} \
	virtual const XMLCh * getId(void) const \
		{return XKMSKeyBindingAbstractTypeImpl::getId();} \
	virtual DSIGKeyInfoList * getKeyInfoList(void) const \
		{return XKMSKeyBindingAbstractTypeImpl::getKeyInfoList();} \
	virtual bool getEncryptionKeyUsage(void) const \
		{return XKMSKeyBindingAbstractTypeImpl::getEncryptionKeyUsage();} \
	virtual bool getSignatureKeyUsage(void) const \
		{return XKMSKeyBindingAbstractTypeImpl::getSignatureKeyUsage();} \
	virtual bool getExchangeKeyUsage(void) const \
		{return XKMSKeyBindingAbstractTypeImpl::getExchangeKeyUsage();} \
	virtual void setId(const XMLCh * id) \
		{XKMSKeyBindingAbstractTypeImpl::setId(id);} \
	virtual void setEncryptionKeyUsage(void) \
		{XKMSKeyBindingAbstractTypeImpl::setEncryptionKeyUsage();} \
	virtual void setSignatureKeyUsage(void) \
		{XKMSKeyBindingAbstractTypeImpl::setSignatureKeyUsage();} \
	virtual void setExchangeKeyUsage(void) \
		{XKMSKeyBindingAbstractTypeImpl::setExchangeKeyUsage();} \
	virtual DSIGKeyInfoList * getKeyInfoList() \
		{return XKMSKeyBindingAbstractTypeImpl::getKeyInfoList();} \
	virtual void clearKeyInfo(void) \
		{XKMSKeyBindingAbstractTypeImpl::clearKeyInfo();} \
	virtual DSIGKeyInfoValue * appendDSAKeyValue(const XMLCh * P,  \
						   const XMLCh * Q,  \
						   const XMLCh * G,  \
						   const XMLCh * Y) \
		{return XKMSKeyBindingAbstractTypeImpl::appendDSAKeyValue(P,Q,G,Y);} \
	virtual DSIGKeyInfoValue * appendRSAKeyValue(const XMLCh * modulus,  \
						   const XMLCh * exponent) \
		{return XKMSKeyBindingAbstractTypeImpl::appendRSAKeyValue(modulus,exponent);} \
	virtual DSIGKeyInfoX509 * appendX509Data(void) \
		{return XKMSKeyBindingAbstractTypeImpl::appendX509Data();} \
	virtual DSIGKeyInfoName * appendKeyName(const XMLCh * name, bool isDName = false) \
		{return XKMSKeyBindingAbstractTypeImpl::appendKeyName(name,isDName);} \
	virtual DSIGKeyInfoPGPData * appendPGPData(const XMLCh * id, const XMLCh * packet) \
		{return XKMSKeyBindingAbstractTypeImpl::appendPGPData(id,packet);} \
	virtual DSIGKeyInfoSPKIData * appendSPKIData(const XMLCh * sexp) \
		{return XKMSKeyBindingAbstractTypeImpl::appendSPKIData(sexp);} \
	virtual DSIGKeyInfoMgmtData * appendMgmtData(const XMLCh * data) \
		{return XKMSKeyBindingAbstractTypeImpl::appendMgmtData(data);} \
	virtual int getUseKeyWithSize(void) const \
		{return XKMSKeyBindingAbstractTypeImpl::getUseKeyWithSize();} \
	virtual XKMSUseKeyWith * getUseKeyWithItem(int item) const \
		{return XKMSKeyBindingAbstractTypeImpl::getUseKeyWithItem(item);} \
	virtual XKMSUseKeyWith * appendUseKeyWithItem( \
			const XMLCh * application,  \
			const XMLCh * identifier) \
		{return XKMSKeyBindingAbstractTypeImpl::appendUseKeyWithItem(application, identifier);}



#endif /* XKMSKEYBINDINGABSTRACTTYPEIMPL_INCLUDE */