blautenb 2003/09/15 04:54:03
Modified: c/src/xenc XENCEncryptionMethod.hpp XENCEncryptedType.hpp
XENCCipherValue.hpp XENCCipher.hpp
Log:
Integration of AlgorithmMapper and DSIG KeyInfo loading
Revision Changes Path
1.2 +27 -1 xml-security/c/src/xenc/XENCEncryptionMethod.hpp
Index: XENCEncryptionMethod.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/xenc/XENCEncryptionMethod.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XENCEncryptionMethod.hpp 31 Aug 2003 12:47:19 -0000 1.1
+++ XENCEncryptionMethod.hpp 15 Sep 2003 11:54:03 -0000 1.2
@@ -94,7 +94,33 @@
class XENCEncryptionMethod {
+public:
+ XENCEncryptionMethod() {};
+
+ virtual ~XENCEncryptionMethod() {};
+
+ /** @name Getter Methods */
+ //@{
+
+ /**
+ * \brief Get the algorithm
+ *
+ * Return the Algorithm URI representing the encryption type for this
+ * encrypted data
+ *
+ * @returns the URI representing the algorithm
+ */
+
+ virtual const XMLCh * getAlgorithm(void) = 0;
+
+ //@}
+
+private:
+
+ // Unimplemented
+ XENCEncryptionMethod(const XENCEncryptionMethod &);
+ XENCEncryptionMethod & operator = (const XENCEncryptionMethod &);
};
1.4 +41 -4 xml-security/c/src/xenc/XENCEncryptedType.hpp
Index: XENCEncryptedType.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/xenc/XENCEncryptedType.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XENCEncryptedType.hpp 11 Sep 2003 11:07:07 -0000 1.3
+++ XENCEncryptedType.hpp 15 Sep 2003 11:54:03 -0000 1.4
@@ -77,6 +77,8 @@
#include <xsec/framework/XSECDefs.hpp>
class XENCCipherData;
+class DSIGKeyInfoList;
+class XENCEncryptionMethod;
/**
* @ingroup xenc
@@ -112,7 +114,7 @@
virtual ~XENCEncryptedType() {};
- /** @name Interface Methods */
+ /** @name Basic Interface Methods */
//@{
/**
@@ -127,6 +129,20 @@
virtual XENCCipherData * getCipherData(void) = 0;
/**
+ * \brief Retrieve the EncryptionMethod element
+ *
+ * The EncryptionMethod element holds information about the
+ * encryption algorithm to be used to encrypt/decrypt the data
+ *
+ * This method provides a means to extract the EncryptionMethod
+ * element from the EncryptedType
+ *
+ * @returns The EncryptionMethod element
+ */
+
+ virtual XENCEncryptionMethod * getEncryptionMethod(void) = 0;
+
+ /**
* \brief Retrieve the DOM Node that heads up the structure
*
* If this object has been fully created, this call will provide
@@ -139,13 +155,34 @@
//@}
+ /** @name KeyInfo Element Manipulation */
+
+ //@{
+
+ /**
+ * \brief Get the list of \<KeyInfo\> elements.
+ *
+ * <p>This function recovers list that contains the KeyInfo elements
+ * read in from the DOM document.</p>
+ *
+ * <p>This list should be used by calling applications to determine
what key
+ * is appropriate for decrypting the document.</p>
+ *
+ * @note The list should never be modified directly. If you need to
+ * add keyInfo elements, call the appropriate functions in EncryptedType
+ *
+ * @returns A pointer to the DSIGKeyInfoList object held by the
XENCCipher
+ */
+
+ virtual DSIGKeyInfoList * getKeyInfoList(void) = 0;
+
+ //@}
+
private:
// Unimplemented
XENCEncryptedType(const XENCEncryptedType &);
XENCEncryptedType & operator = (const XENCEncryptedType &);
-
-
};
1.2 +18 -1 xml-security/c/src/xenc/XENCCipherValue.hpp
Index: XENCCipherValue.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/xenc/XENCCipherValue.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XENCCipherValue.hpp 31 Aug 2003 12:47:19 -0000 1.1
+++ XENCCipherValue.hpp 15 Sep 2003 11:54:03 -0000 1.2
@@ -117,6 +117,23 @@
//@}
+ /** @name Set Interface Methods */
+ //@{
+
+ /**
+ * \brief Set the encrypted value
+ *
+ * Sets the base64 encoded string held in the CipherValue.
+ *
+ * @note This should not normally be called directly - use the
XENCCipher
+ * interface for normal operation
+ *
+ * @param value The string to set
+ */
+
+ virtual void setCipherString(const XMLCh * value) = 0;
+
+ //@}
private:
// Unimplemented
1.4 +34 -4 xml-security/c/src/xenc/XENCCipher.hpp
Index: XENCCipher.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/xenc/XENCCipher.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XENCCipher.hpp 11 Sep 2003 11:07:07 -0000 1.3
+++ XENCCipher.hpp 15 Sep 2003 11:54:03 -0000 1.4
@@ -73,6 +73,7 @@
#include <xsec/framework/XSECDefs.hpp>
#include <xsec/xenc/XENCCipherData.hpp>
+#include <xsec/dsig/DSIGConstants.hpp>
// Xerces
@@ -81,6 +82,7 @@
class XSECCryptoKey;
class XENCEncryptedData;
+class XSECKeyInfoResolver;
/**
* @defgroup xenc XML Encryption Implementation
@@ -158,13 +160,22 @@
* is replaced with an EncryptedData element
*
* @param element Element (and children) to encrypt
+ * @param em The encryptionMethod to use for this encryption. Use
+ * ENCRYPT_NONE if a user defined type is required.
+ * @param algorithmURI If ENCRYPT_NONE is passed in, this will be
+ * used to set the algorithm URI. If this is also NULL - no
+ * EncryptionMethod will be set. <b>NULL Value Unsupported if em not
+ * set! It's use could cause problems!</b>
+ *
* @returns The owning document with the element replaced, or NULL
* if the decryption fails for some reason (normally an exception).
* @throws XSECException if the encryption fails.
*/
virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * encryptElement(
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * element
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * element,
+ encryptionMethod em,
+ const XMLCh * algorithmURI = NULL
) = 0;
//@}
@@ -211,6 +222,22 @@
virtual void setKey(XSECCryptoKey * key) = 0;
/**
+ * \brief Register a KeyInfoResolver
+ *
+ * Registers a KeyInfoResolver to be used by the cipher when
+ * it needs to find a key to be used to decrypt some ciper text
+ *
+ * @note The library will use the #clone() function from the resolver
+ * to get a copy. The passed in resolver remains the property of
+ * the calling function
+ *
+ * @param resolver Resolver to clone and use for resolving keys
+ *
+ */
+
+ virtual void setKeyInfoResolver(const XSECKeyInfoResolver * resolver) =
0;
+
+ /**
* \brief Set prefix for XENC nodes
*
* Set the namespace prefix the library will use when creating
@@ -237,12 +264,15 @@
* EncryptedData and delete any currently being held.
*
* @param type Should this set up a CipherReference or a CipherValue
+ * @param algorithm URI string to use for the Algorithm attribute in
EncryptionMethod.
+ * Set to NULL for no defined algorithm.
* @param value String to set the cipher data to if the type is
VALUE_TYPE
* @returns An XENCEncryptedData object
*/
- virtual XENCEncryptedData *
createEncryptedData(XENCCipherData::XENCCipherDataType type,
-
XMLCh * value) = 0;
+ virtual XENCEncryptedData *
createEncryptedData(XENCCipherData::XENCCipherDataType type,
+
const XMLCh * algorithm,
+
const XMLCh * value) = 0;
//@}