File: DSIGKeyInfo.hpp

package info (click to toggle)
xml-security-c 1.5.1-3%2Bsqueeze3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 7,424 kB
  • ctags: 5,832
  • sloc: cpp: 45,357; sh: 8,270; makefile: 689
file content (167 lines) | stat: -rw-r--r-- 3,728 bytes parent folder | download | duplicates (2)
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
/*
 * Copyright 2002-2009 The Apache Software Foundation.
 *
 * Licensed 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
 *
 * DSIGKeyInfo := Base (virtual) class that defines an XSEC KeyInfo node
 *
 * Author(s): Berin Lautenbach
 *
 * $Id: DSIGKeyInfo.hpp 738757 2009-01-29 04:25:58Z scantor $
 *
 */

#ifndef DSIGKEYINFO_INCLUDE
#define DSIGKEYINFO_INCLUDE

// XSEC Includes

#include <xsec/utils/XSECDOMUtils.hpp>
#include <xsec/utils/XSECSafeBufferFormatter.hpp>
#include <xsec/enc/XSECCryptoKey.hpp>

#include <xercesc/dom/DOM.hpp>

class DSIGSignature;
class XSECEnv;

/**
 * @ingroup pubsig
 */

/**
 * @brief Base class for <Key*> nodes in a KeyInfo list.
 *
 * Digital signatures can have a number of KeyInfo elements that are
 * used to communicate information about what key to use between the
 * signer and the validator.
 *
 * In the XML-Security-C libary, KeyInfo elements are only used for
 * holding information about keys.  They do not in themselves perform
 * any cryptographic function.
 *
 */


class DSIG_EXPORT DSIGKeyInfo {

public:

	/**
	 * \brief List of potential KeyInfo types
	 *
	 * The keyIntoType enumerated type defines the KeyInfo types known by
	 * the XML-Security-C library.
	 *
	 */


	enum keyInfoType {
        KEYINFO_EXTENSION       = 0,            // Extension type unknown to library
		KEYINFO_NOTSET			= 1,			// Empty key type
		KEYINFO_X509			= 2,			// X509 Certificate (with embedded key)
		KEYINFO_VALUE_DSA		= 3,			// DSA Key
		KEYINFO_VALUE_RSA		= 4,
		KEYINFO_NAME			= 5,			// A name of a key (application dependant)
		KEYINFO_PGPDATA			= 6,			// A PGP key
		KEYINFO_SPKIDATA		= 7,
		KEYINFO_MGMTDATA		= 8,			// Management data
		KEYINFO_ENCRYPTEDKEY	= 9 			// XML Encryption - Encrypted Key
	};

public:

	/** @name Constructors and Destructors */
	//@{

	/**
	 * \brief Construct from an owning signature
	 *
	 * All KeyInfo types take a constructor that provides the controlling environment.
	 *
	 * @param env The environment that the KeyInfo is operating within
	 */

	DSIGKeyInfo(const XSECEnv * env) {mp_keyInfoDOMNode = NULL; mp_env = env;}

	/**
	 * \brief The Destructor
	 */

	virtual ~DSIGKeyInfo() {};

	//@}

	/** @name Get functions */
	//@{

	/**
	 * \brief Return type
	 *
	 * Can be used to find what type of KeyInfo this is
	 */

	virtual keyInfoType getKeyInfoType(void) const = 0;

	/**
	 * \brief Return the DOMNode that heads up this KeyInfo child
	 */

	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getKeyInfoDOMNode()
		{return mp_keyInfoDOMNode;}

	/**
	 * \brief Return the name of this key
	 *
	 * For those KeyInfo types that have a keyname, this function should return
	 * it.  For certificates, this may be the DN.
	 *
	 * @returns A pointer to a buffer containing the name
	 */

	virtual const XMLCh * getKeyName(void) const = 0;

	//@}

	/** @name Load and Set */
	//@{

	/**
	 * \brief Load the DOM structures.
	 *
	 * Used by the library to instruct the object to load information from
	 * the DOM nodes
	 */

	virtual void load() = 0;

	//@}

protected:

	XERCES_CPP_NAMESPACE_QUALIFIER DOMNode			* mp_keyInfoDOMNode;
	const XSECEnv									* mp_env;

private:
	DSIGKeyInfo();

};




#endif /* #define XSECKEYINFO_INCLUDE */