You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2003/03/01 07:27:30 UTC
cvs commit: xml-security/c/src/utils XSECBinTXFMInputStream.hpp XSECPlatformUtils.hpp XSECSafeBuffer.hpp XSECSafeBufferFormatter.hpp XSECXPathNodeList.cpp
blautenb 2003/02/28 22:27:30
Modified: c/src/dsig DSIGKeyInfoX509.cpp DSIGSignature.cpp
DSIGSignedInfo.cpp DSIGTransformXPath.cpp
c/src/enc XSECCryptoKeyDSA.hpp XSECCryptoKeyHMAC.hpp
XSECCryptoKeyRSA.hpp XSECCryptoX509.hpp
XSECKeyInfoResolver.hpp
XSECKeyInfoResolverDefault.cpp
XSECKeyInfoResolverDefault.hpp
c/src/enc/OpenSSL OpenSSLCryptoKeyRSA.cpp
c/src/framework XSECDefs.hpp XSECError.hpp XSECException.hpp
XSECProvider.cpp XSECProvider.hpp
XSECURIResolverXerces.cpp
c/src/tools/checksig checksig.cpp
c/src/tools/xtest xtest.cpp
c/src/transformers TXFMBase.hpp TXFMBase64.cpp
TXFMBase64.hpp TXFMC14n.cpp TXFMC14n.hpp
TXFMChain.hpp TXFMDocObject.hpp TXFMEnvelope.hpp
TXFMOutputFile.hpp TXFMParser.hpp TXFMSB.hpp
TXFMSHA1.hpp TXFMURL.hpp TXFMXPath.cpp
TXFMXPath.hpp TXFMXSL.cpp TXFMXSL.hpp
c/src/utils XSECBinTXFMInputStream.hpp XSECPlatformUtils.hpp
XSECSafeBuffer.hpp XSECSafeBufferFormatter.hpp
XSECXPathNodeList.cpp
Log:
Java docs + memory cleaning
Revision Changes Path
1.4 +3 -3 xml-security/c/src/dsig/DSIGKeyInfoX509.cpp
Index: DSIGKeyInfoX509.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoX509.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DSIGKeyInfoX509.cpp 22 Feb 2003 08:47:23 -0000 1.3
+++ DSIGKeyInfoX509.cpp 1 Mar 2003 06:27:28 -0000 1.4
@@ -168,11 +168,11 @@
XSECnew(h, X509Holder);
- h->mp_encodedX509 = certElt->getNodeValue();
-
// Add to the list
m_X509List.push_back(h);
+
+ h->mp_encodedX509 = certElt->getNodeValue();
}
}
1.7 +9 -7 xml-security/c/src/dsig/DSIGSignature.cpp
Index: DSIGSignature.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGSignature.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DSIGSignature.cpp 22 Feb 2003 08:47:23 -0000 1.6
+++ DSIGSignature.cpp 1 Mar 2003 06:27:28 -0000 1.7
@@ -125,13 +125,14 @@
}
+ Janitor<XSECCryptoBase64> j_b64(b64);
+
strncpy((char *) b64Str, (char *) b64SB.rawBuffer(), 1023);
b64Str[1023] = '\0'; // Just in case
b64->decodeInit();
outputLen = b64->decode((unsigned char *) b64Str, strlen((char *) b64Str), outputStr, 1024);
outputLen += b64->decodeFinish(&outputStr[outputLen], 1024 - outputLen);
- delete b64;
// Compare
@@ -212,6 +213,8 @@
}
+ Janitor<XSECCryptoBase64> j_b64(b64);
+
// Determine length to translate
unsigned int size;
@@ -231,7 +234,6 @@
b64->encodeInit();
outputLen = b64->encode((unsigned char *) raw, rawLen, b64Str, 1024);
outputLen += b64->encodeFinish(&b64Str[outputLen], 1024 - outputLen);
- delete b64;
// Copy out
@@ -529,7 +531,7 @@
mp_KeyInfoNode->release(); // No longer required
- mp_KeyInfoNode = 0;
+ mp_KeyInfoNode = NULL;
// Clear out the list
m_keyInfoList.empty();
@@ -578,7 +580,7 @@
// Create the new element
DSIGKeyInfoValue * v;
- v = new DSIGKeyInfoValue(this);
+ XSECnew(v, DSIGKeyInfoValue(this));
mp_KeyInfoNode->appendChild(v->createBlankDSAKeyValue(P, Q, G, Y));
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
@@ -596,7 +598,7 @@
DSIGKeyInfoX509 * x;
- x = new DSIGKeyInfoX509(this);
+ XSECnew(x, DSIGKeyInfoX509(this));
mp_KeyInfoNode->appendChild(x->createBlankX509Data());
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
@@ -614,7 +616,7 @@
DSIGKeyInfoName * n;
- n = new DSIGKeyInfoName(this);
+ XSECnew(n, DSIGKeyInfoName(this));
mp_KeyInfoNode->appendChild(n->createBlankKeyName(name));
mp_KeyInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
1.3 +5 -0 xml-security/c/src/dsig/DSIGSignedInfo.cpp
Index: DSIGSignedInfo.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGSignedInfo.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DSIGSignedInfo.cpp 9 Feb 2003 11:13:47 -0000 1.2
+++ DSIGSignedInfo.cpp 1 Mar 2003 06:27:28 -0000 1.3
@@ -77,7 +77,10 @@
#include <xsec/utils/XSECDOMUtils.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
+#include <xercesc/util/Janitor.hpp>
+
XSEC_USING_XERCES(DOMNamedNodeMap);
+XSEC_USING_XERCES(Janitor);
// Constructors and Destructors
@@ -189,6 +192,7 @@
DSIGReference * ref;
XSECnew(ref, DSIGReference(mp_parentSignature));
+ Janitor<DSIGReference> j_ref(ref);
DOMNode *refNode = ref->createBlankReference(URI, hm, type);
@@ -197,6 +201,7 @@
mp_signedInfoNode->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
// Add to the reference List
+ j_ref.release();
mp_referenceList->addReference(ref);
return ref;
1.6 +5 -1 xml-security/c/src/dsig/DSIGTransformXPath.cpp
Index: DSIGTransformXPath.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/dsig/DSIGTransformXPath.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DSIGTransformXPath.cpp 21 Feb 2003 11:53:06 -0000 1.5
+++ DSIGTransformXPath.cpp 1 Mar 2003 06:27:28 -0000 1.6
@@ -130,6 +130,10 @@
// XPath transform
XSECnew(x, TXFMXPath(mp_txfmNode->getOwnerDocument()));
input->appendTxfm(x);
+
+ // These can throw, but the TXFMXPath is now owned by the chain, so will
+ // be cleaned up down the calling stack.
+
x->setNameSpace(mp_NSMap);
x->evaluateExpr(mp_txfmNode, m_expr);
1.3 +125 -13 xml-security/c/src/enc/XSECCryptoKeyDSA.hpp
Index: XSECCryptoKeyDSA.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECCryptoKeyDSA.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECCryptoKeyDSA.hpp 9 Feb 2003 11:13:49 -0000 1.2
+++ XSECCryptoKeyDSA.hpp 1 Mar 2003 06:27:28 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -75,40 +73,154 @@
#include <xsec/enc/XSECCryptoKey.hpp>
+/**
+ * \ingroup crypto
+ * @{
+ */
+
+/**
+ * \brief Interface class for DSA keys.
+ *
+ * The library uses classes derived from this to process DSA keys.
+ */
+
class DSIG_EXPORT XSECCryptoKeyDSA : public XSECCryptoKey {
public :
- // Constructors/Destructors
+ /** @name Constructors and Destructors */
+ //@{
XSECCryptoKeyDSA() {};
virtual ~XSECCryptoKeyDSA() {};
- // Generic key functions
+ //@}
+
+ /** @name Key Interface methods */
+ //@{
+
+ /**
+ * \brief Return the type of this key.
+ *
+ * For DSA keys, this allows people to determine whether this is a
+ * public key, private key or a key pair
+ */
virtual XSECCryptoKey::KeyType getKeyType() {return KEY_NONE;}
- virtual XSECCryptoKey * clone() = 0;
- // DSA Specific Functions
+ /**
+ * \brief Replicate key
+ */
- virtual void loadPBase64BigNums(const char * b64, unsigned int len) = 0;
- virtual void loadQBase64BigNums(const char * b64, unsigned int len) = 0;
- virtual void loadGBase64BigNums(const char * b64, unsigned int len) = 0;
- virtual void loadYBase64BigNums(const char * b64, unsigned int len) = 0;
- virtual void loadJBase64BigNums(const char * b64, unsigned int len) = 0;
+ virtual XSECCryptoKey * clone() = 0;
- // Signature functions
+ //@}
+
+ /** @name Mandatory DSA interface methods
+ *
+ * These classes are required by the library.
+ */
+ //@{
+
+ /**
+ * \brief Verify a signature
+ *
+ * The library will call this function to validate a signature
+ *
+ * @param hashBuf Buffer containing the pre-calculated (binary) digest
+ * @param hashLen Length of the data in the digest buffer
+ * @param base64Signature Buffer containing the Base64 encoded signature
+ * @param sigLen Length of the data in the signature buffer
+ * @returns true if the signature was valid, false otherwise
+ */
virtual bool verifyBase64Signature(unsigned char * hashBuf,
unsigned int hashLen,
char * base64Signature,
unsigned int sigLen) = 0;
+ /**
+ * \brief Create a signature
+ *
+ * The library will call this function to create a signature from
+ * a pre-calculated digest. The output signature is required to
+ * be Base64 encoded such that it can be placed directly into the
+ * XML document
+ *
+ * @param hashBuf Buffer containing the pre-calculated (binary) digest
+ * @param hashLen Number of bytes of hash in the hashBuf
+ * @param base64SignatureBuf Buffer to place the base64 encoded result
+ * in.
+ * @param base64SignatureBufLen Implementations need to ensure they do
+ * not write more bytes than this into the buffer
+ */
+
virtual unsigned int signBase64Signature(unsigned char * hashBuf,
unsigned int hashLen,
char * base64SignatureBuf,
unsigned int base64SignatureBufLen) = 0;
+ //@}
+
+ /** @name Optional Interface methods
+ *
+ * These functions do not necessarily have to be implmented. They
+ * are used by XSECKeyInfoResolverDefault to try to create a key from
+ * KeyInfo elements without knowing anything else.
+ *
+ * If an interface class does not implement these functions, a simple
+ * stub that does nothing should be used.
+ */
+ //@{
+
+ /**
+ * \brief Load P
+ *
+ * @param b64 Base64 encoded parameter - read from XML document
+ * @param len Length of the encoded string
+ */
+
+ virtual void loadPBase64BigNums(const char * b64, unsigned int len) = 0;
+
+ /**
+ * \brief Load Q
+ *
+ * @param b64 Base64 encoded parameter - read from XML document
+ * @param len Length of the encoded string
+ */
+
+ virtual void loadQBase64BigNums(const char * b64, unsigned int len) = 0;
+
+ /**
+ * \brief Load G
+ *
+ * @param b64 Base64 encoded parameter - read from XML document
+ * @param len Length of the encoded string
+ */
+
+ virtual void loadGBase64BigNums(const char * b64, unsigned int len) = 0;
+
+ /**
+ * \brief Load Y
+ *
+ * @param b64 Base64 encoded parameter - read from XML document
+ * @param len Length of the encoded string
+ */
+
+ virtual void loadYBase64BigNums(const char * b64, unsigned int len) = 0;
+
+ /**
+ * \brief Load J
+ *
+ * @param b64 Base64 encoded parameter - read from XML document
+ * @param len Length of the encoded string
+ */
+
+ virtual void loadJBase64BigNums(const char * b64, unsigned int len) = 0;
+
+ //@}
};
+
+/** @} */
#endif /* XSECCRYPTOKEYDSA_INCLUDE */
1.3 +66 -7 xml-security/c/src/enc/XSECCryptoKeyHMAC.hpp
Index: XSECCryptoKeyHMAC.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECCryptoKeyHMAC.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECCryptoKeyHMAC.hpp 9 Feb 2003 11:13:49 -0000 1.2
+++ XSECCryptoKeyHMAC.hpp 1 Mar 2003 06:27:28 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -76,24 +74,85 @@
#include <xsec/enc/XSECCryptoKey.hpp>
#include <xsec/utils/XSECSafeBuffer.hpp>
+/**
+ * \ingroup crypto
+ * @{
+ */
+
+/**
+ * \brief Interface class for HMAC keys.
+ *
+ * The library uses classes derived from this to process HMAC keys.
+ */
+
class DSIG_EXPORT XSECCryptoKeyHMAC : public XSECCryptoKey {
public :
- // Constructors/Destructors
+ /** @name Constructors and Destructors */
+ //@{
XSECCryptoKeyHMAC() {};
virtual ~XSECCryptoKeyHMAC() {};
- virtual XSECCryptoKey * clone() = 0;
+
+ //@}
+
+ /** @name Key Interface methods */
+ //@{
- // Generic key functions
+ /**
+ * \brief Return the type of this key.
+ *
+ * For DSA keys, this allows people to determine whether this is a
+ * public key, private key or a key pair
+ */
virtual XSECCryptoKey::KeyType getKeyType() {return KEY_HMAC;}
- // HMAC Key functions
+ /**
+ * \brief Replicate key
+ */
+
+ virtual XSECCryptoKey * clone() = 0;
+
+ //@}
+
+ /** @name Optional Interface methods
+ *
+ * These functions do not necessarily have to be implmented. They
+ * are used by XSECKeyInfoResolverDefault to try to create a key from
+ * KeyInfo elements without knowing anything else.
+ *
+ * If an interface class does not implement these functions, a simple
+ * stub that does nothing should be used.
+ */
+
+ /**
+ * \brief Set the key
+ *
+ * Set the key from the buffer
+ *
+ * @param inBuf Buffer containing the key
+ * @param inLength Number of bytes of key in the buffer
+ */
virtual void setKey(unsigned char * inBuf, unsigned int inLength) = 0;
+
+ /**
+ * \brief Get the key value
+ *
+ * Copy the key into the safeBuffer and return the number of bytes
+ * copied.
+ *
+ * @param outBuf Buffer to copy key into
+ * @returns number of bytes copied in
+ */
+
virtual unsigned int getKey(safeBuffer &outBuf) = 0;
+
+ //@}
};
+
+/** @} */
#endif /* XSECCRYPTOKEYHMAC_INCLUDE */
1.3 +111 -11 xml-security/c/src/enc/XSECCryptoKeyRSA.hpp
Index: XSECCryptoKeyRSA.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECCryptoKeyRSA.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECCryptoKeyRSA.hpp 9 Feb 2003 11:13:49 -0000 1.2
+++ XSECCryptoKeyRSA.hpp 1 Mar 2003 06:27:28 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -75,37 +73,139 @@
#include <xsec/enc/XSECCryptoKey.hpp>
+/**
+ * \ingroup crypto
+ * @{
+ */
+
+/**
+ * \brief Interface class for RSA keys.
+ *
+ * The library uses classes derived from this to process RSA keys.
+ */
+
+
class DSIG_EXPORT XSECCryptoKeyRSA : public XSECCryptoKey {
public :
- // Constructors/Destructors
-
+ /** @name Constructors and Destructors */
+ //@{
+
XSECCryptoKeyRSA() {};
virtual ~XSECCryptoKeyRSA() {};
- // Generic key functions
+ //@}
+
+ /** @name Key Interface methods */
+ //@{
+
+ /**
+ * \brief Return the type of this key.
+ *
+ * For RSA keys, this allows people to determine whether this is a
+ * public key, private key or a key pair
+ */
virtual XSECCryptoKey::KeyType getKeyType() {return KEY_NONE;}
- virtual XSECCryptoKey * clone() = 0;
+
+ /**
+ * \brief Replicate key
+ */
- // RSA Specific Functions
+ virtual XSECCryptoKey * clone() = 0;
- virtual void loadPublicModulusBase64BigNums(const char * b64, unsigned int len) = 0;
- virtual void loadPublicExponentBase64BigNums(const char * b64, unsigned int len) = 0;
+ //@}
- // Signature functions
+ /** @name Mandatory RSA interface methods
+ *
+ * These classes are required by the library.
+ */
+ //@{
+
+ /**
+ * \brief Verify a SHA1 PKCS1 encoded signature
+ *
+ * The library will call this function to validate an RSA signature
+ * The standard by default uses SHA1 in a PKCS1 encoding.
+ *
+ * @param hashBuf Buffer containing the pre-calculated (binary) digest
+ * @param hashLen Length of the data in the digest buffer
+ * @param base64Signature Buffer containing the Base64 encoded signature
+ * @param sigLen Length of the data in the signature buffer
+ * @returns true if the signature was valid, false otherwise
+ */
virtual bool verifySHA1PKCS1Base64Signature(const unsigned char * hashBuf,
unsigned int hashLen,
const char * base64Signature,
unsigned int sigLen) = 0;
+ /**
+ * \brief Create a signature
+ *
+ * The library will call this function to create a signature from
+ * a pre-calculated digest. The output signature is required to
+ * be Base64 encoded such that it can be placed directly into the
+ * XML document
+ *
+ * This call needs to do a PKCS1 encode for a SHA-1 signature.
+ *
+ * @param hashBuf Buffer containing the pre-calculated (binary) digest
+ * @param hashLen Number of bytes of hash in the hashBuf
+ * @param base64SignatureBuf Buffer to place the base64 encoded result
+ * in.
+ * @param base64SignatureBufLen Implementations need to ensure they do
+ * not write more bytes than this into the buffer
+ */
+
+
virtual unsigned int signSHA1PKCS1Base64Signature(unsigned char * hashBuf,
unsigned int hashLen,
char * base64SignatureBuf,
unsigned int base64SignatureBufLen) = 0;
+ //@}
+
+ /** @name Optional Interface methods
+ *
+ * These functions do not necessarily have to be implmented. They
+ * are used by XSECKeyInfoResolverDefault to try to create a key from
+ * KeyInfo elements without knowing anything else.
+ *
+ * If an interface class does not implement these functions, a simple
+ * stub that does nothing should be used.
+ */
+
+ //@{
+
+ /**
+ * \brief Load the modulus
+ *
+ * Load the modulus from a Base64 encoded string
+ *
+ * param b64 A buffer containing the encoded string
+ * param len The length of the data in the buffer
+ */
+
+ virtual void loadPublicModulusBase64BigNums(const char * b64, unsigned int len) = 0;
+
+ /**
+ * \brief Load the exponent
+ *
+ * Load the exponent from a Base64 encoded string
+ *
+ * param b64 A buffer containing the encoded string
+ * param len The length of the data in the buffer
+ */
+
+ virtual void loadPublicExponentBase64BigNums(const char * b64, unsigned int len) = 0;
+
+ //@}
+
};
+
+/** @} */
+
#endif /* XSECCRYPTOKEYRSA_INCLUDE */
1.3 +66 -9 xml-security/c/src/enc/XSECCryptoX509.hpp
Index: XSECCryptoX509.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECCryptoX509.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECCryptoX509.hpp 9 Feb 2003 11:13:49 -0000 1.2
+++ XSECCryptoX509.hpp 1 Mar 2003 06:27:28 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -77,26 +75,85 @@
#include <xsec/enc/XSECCryptoKey.hpp>
#include <xsec/utils/XSECSafeBuffer.hpp>
+/**
+ * \ingroup crypto
+ * @{
+ */
+
+/**
+ * \brief Interface class for X509 certificates.
+ *
+ * The library uses classes derived from this to process X509 Certificates.
+ *
+ * Strictly speaking, this class is not required. However it is used by
+ * XSECKeyInfoResolverDefault to extract a key from a certificate in cases
+ * where the caller is not worried about the trust level of the certificate.
+ *
+ */
+
+
class DSIG_EXPORT XSECCryptoX509 {
public :
+ /** @name Constructors and Destructors */
+ //@{
+
XSECCryptoX509() {};
virtual ~XSECCryptoX509() {};
- // load functions
+ //@}
+ /** @name Key Interface methods */
+ //@{
+
+ /**
+ * \brief Return the type of the key stored in the certificate.
+ *
+ * The implementation is expected to extract the key from the
+ * certificate and determine the type.
+ *
+ */
- virtual void loadX509Base64Bin(const char * buf, unsigned int len) = 0;
+ virtual XSECCryptoKey::KeyType getPublicKeyType() = 0;
- // Info functions
+ /**
+ * \brief Get a copy of the public key.
+ *
+ * The implementation should extract the key from the certificate,
+ * create an instance of the appropriate key type, and return it.
+ *
+ */
+
+ virtual XSECCryptoKey * clonePublicKey() = 0;
+
+ //@}
+
+ /** @name Load and Get the certificate */
+ //@{
+
+ /**
+ * \brief Load a certificate into the object.
+ *
+ * Take a base64 DER encoded certificate and load.
+ *
+ * @param buf A buffer containing the Base64 encoded certificate
+ * @param len The number of bytes of data in the certificate.
+ */
- virtual XSECCryptoKey::KeyType getPublicKeyType() = 0;
+ virtual void loadX509Base64Bin(const char * buf, unsigned int len) = 0;
+
+ /**
+ * \brief Get a Base64 DER encoded copy of the certificate
+ *
+ * @returns A safeBuffer containing the DER encoded certificate
+ */
- // Get functions
- virtual XSECCryptoKey * clonePublicKey() = 0; // Return a copy (ownership of caller)
virtual safeBuffer &getDEREncodingSB(void) = 0; // Get the DER string
+
+ //@}
};
+/** @} */
#endif /* XSECCRYPTOX509_INCLUDE */
1.3 +2 -4 xml-security/c/src/enc/XSECKeyInfoResolver.hpp
Index: XSECKeyInfoResolver.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECKeyInfoResolver.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECKeyInfoResolver.hpp 9 Feb 2003 11:13:49 -0000 1.2
+++ XSECKeyInfoResolver.hpp 1 Mar 2003 06:27:28 -0000 1.3
@@ -65,9 +65,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -79,7 +77,7 @@
#include <xsec/enc/XSECCryptoKey.hpp>
/**
- * @ingroup pubsig
+ * @ingroup interfaces
*/
/*\@{*/
1.4 +11 -3 xml-security/c/src/enc/XSECKeyInfoResolverDefault.cpp
Index: XSECKeyInfoResolverDefault.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECKeyInfoResolverDefault.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSECKeyInfoResolverDefault.cpp 22 Feb 2003 08:47:24 -0000 1.3
+++ XSECKeyInfoResolverDefault.cpp 1 Mar 2003 06:27:28 -0000 1.4
@@ -74,6 +74,10 @@
#include <xsec/dsig/DSIGKeyInfoValue.hpp>
#include <xsec/framework/XSECError.hpp>
+#include <xercesc/util/Janitor.hpp>
+
+XSEC_USING_XERCES(Janitor);
+
// --------------------------------------------------------------------------------
// Construct/Destruct
// --------------------------------------------------------------------------------
@@ -116,6 +120,8 @@
ret = NULL;
const XMLCh * x509Str;
XSECCryptoX509 * x509 = XSECPlatformUtils::g_cryptoProvider->X509();
+ Janitor<XSECCryptoX509> j_x509(x509);
+
x509Str = ((DSIGKeyInfoX509 *) lst->item(i))->getCertificateItem(0);
if (x509Str != 0) {
@@ -128,8 +134,6 @@
ret = x509->clonePublicKey();
}
- delete x509;
-
if (ret != NULL)
return ret;
@@ -140,6 +144,7 @@
{
XSECCryptoKeyDSA * dsa = XSECPlatformUtils::g_cryptoProvider->keyDSA();
+ Janitor<XSECCryptoKeyDSA> j_dsa(dsa);
safeBuffer value;
@@ -152,6 +157,7 @@
value << (*mp_formatter << ((DSIGKeyInfoValue *) lst->item(i))->getDSAY());
dsa->loadYBase64BigNums(value.rawCharBuffer(), strlen(value.rawCharBuffer()));
+ j_dsa.release();
return dsa;
}
break;
@@ -160,6 +166,7 @@
{
XSECCryptoKeyRSA * rsa = XSECPlatformUtils::g_cryptoProvider->keyRSA();
+ Janitor<XSECCryptoKeyRSA> j_rsa(rsa);
safeBuffer value;
@@ -168,6 +175,7 @@
value << (*mp_formatter << ((DSIGKeyInfoValue *) lst->item(i))->getRSAExponent());
rsa->loadPublicExponentBase64BigNums(value.rawCharBuffer(), strlen(value.rawCharBuffer()));
+ j_rsa.release();
return rsa;
}
1.3 +1 -1 xml-security/c/src/enc/XSECKeyInfoResolverDefault.hpp
Index: XSECKeyInfoResolverDefault.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECKeyInfoResolverDefault.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECKeyInfoResolverDefault.hpp 9 Feb 2003 11:13:49 -0000 1.2
+++ XSECKeyInfoResolverDefault.hpp 1 Mar 2003 06:27:28 -0000 1.3
@@ -77,7 +77,7 @@
#include <xsec/enc/XSECKeyInfoResolver.hpp>
/**
- * @ingroup pubsig
+ * @ingroup interfaces
*/
/*\@{*/
1.4 +6 -7 xml-security/c/src/enc/OpenSSL/OpenSSLCryptoKeyRSA.cpp
Index: OpenSSLCryptoKeyRSA.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoKeyRSA.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- OpenSSLCryptoKeyRSA.cpp 22 Feb 2003 08:47:24 -0000 1.3
+++ OpenSSLCryptoKeyRSA.cpp 1 Mar 2003 06:27:28 -0000 1.4
@@ -73,6 +73,10 @@
#include <xsec/enc/XSECCryptoException.hpp>
#include <xsec/framework/XSECError.hpp>
+#include <xercesc/util/Janitor.hpp>
+
+XSEC_USING_XERCES(ArrayJanitor);
+
#include <memory.h>
// Define OID for SHA-1 hash
@@ -225,6 +229,7 @@
// Decrypt will always be longer than (RSA_len(key) - 11)
decryptBuf = new unsigned char [RSA_size(mp_rsaKey)];
+ ArrayJanitor<unsigned char> j_decryptBuf(decryptBuf);
// Note at this time only supports PKCS1 padding
// As that is what is defined in the standard.
@@ -241,14 +246,12 @@
if (decryptSize < 0) {
- delete[] decryptBuf;
throw XSECCryptoException(XSECCryptoException::RSAError,
"OpenSSL:RSA::verify() - Error decrypting signature");
}
if (decryptSize != (int) (sha1OIDLen + hashLen)) {
- delete[] decryptBuf;
return false;
}
@@ -257,7 +260,6 @@
if (sha1OID[t] != decryptBuf[t]) {
- delete[] decryptBuf;
return false;
}
@@ -268,7 +270,6 @@
if (hashBuf[t-sha1OIDLen] != decryptBuf[t]) {
- delete[] decryptBuf;
return false;
}
@@ -276,8 +277,6 @@
}
// All OK
- delete[] decryptBuf;
-
return true;
}
1.3 +1 -3 xml-security/c/src/framework/XSECDefs.hpp
Index: XSECDefs.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/framework/XSECDefs.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECDefs.hpp 9 Feb 2003 11:13:50 -0000 1.2
+++ XSECDefs.hpp 1 Mar 2003 06:27:29 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
1.3 +15 -4 xml-security/c/src/framework/XSECError.hpp
Index: XSECError.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/framework/XSECError.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECError.hpp 9 Feb 2003 11:13:50 -0000 1.2
+++ XSECError.hpp 1 Mar 2003 06:27:29 -0000 1.3
@@ -60,21 +60,32 @@
/*
* XSEC
*
- * XSECError := General class for handling errors
+ * XSECError := General include file for handling errors
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
#include <xsec/framework/XSECDefs.hpp>
#include <xsec/framework/XSECException.hpp>
+/**
+ * @ingroup pubsig
+ * @{
+ */
+
+/**
+ * \brief Error strings
+ *
+ * An array that can be used to obtain an error string associated with
+ * an exception number.
+ */
+
extern char * XSECExceptionStrings [];
+/** @} */
#if defined (_WIN32) && defined (_DEBUG)
1.4 +2 -4 xml-security/c/src/framework/XSECException.hpp
Index: XSECException.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/framework/XSECException.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSECException.hpp 12 Feb 2003 11:21:03 -0000 1.3
+++ XSECException.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -220,9 +218,9 @@
/* Unimplemented Constructor */
XSECException();
- /*\@}*/
};
+/*\@}*/
#endif /* XSECEXCEPTION_INCLUDE */
1.4 +3 -3 xml-security/c/src/framework/XSECProvider.cpp
Index: XSECProvider.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/framework/XSECProvider.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSECProvider.cpp 9 Feb 2003 11:13:50 -0000 1.3
+++ XSECProvider.cpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -65,9 +65,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -163,6 +161,8 @@
++i;
if (i == m_activeSignatures.end()) {
+
+ m_providerMutex.unlock();
throw XSECException(XSECException::ProviderError,
"Attempt to release a signature that was not created by this provider");
1.4 +2 -0 xml-security/c/src/framework/XSECProvider.hpp
Index: XSECProvider.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/framework/XSECProvider.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSECProvider.hpp 9 Feb 2003 11:13:50 -0000 1.3
+++ XSECProvider.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -230,4 +230,6 @@
XERCES_CPP_NAMESPACE_QUALIFIER XMLMutex m_providerMutex;
};
+/** @} */
+
#endif /* XSECPROVIDER_INCLUDE */
1.3 +9 -11 xml-security/c/src/framework/XSECURIResolverXerces.cpp
Index: XSECURIResolverXerces.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/framework/XSECURIResolverXerces.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECURIResolverXerces.cpp 9 Feb 2003 11:13:50 -0000 1.2
+++ XSECURIResolverXerces.cpp 1 Mar 2003 06:27:29 -0000 1.3
@@ -74,7 +74,7 @@
#include <xsec/framework/XSECDefs.hpp>
#include <xsec/framework/XSECURIResolverXerces.hpp>
-#include <xsec/framework/XSECException.hpp>
+#include <xsec/framework/XSECError.hpp>
#include <xercesc/framework/URLInputSource.hpp>
#include <xercesc/util/XMLString.hpp>
@@ -98,13 +98,13 @@
}
else
- mp_baseURI = 0;
+ mp_baseURI = NULL;
};
XSECURIResolverXerces::~XSECURIResolverXerces() {
- if (mp_baseURI != 0)
+ if (mp_baseURI != NULL)
delete[] mp_baseURI;
}
@@ -123,19 +123,17 @@
BinInputStream * is; // To handle the actual input
- if (mp_baseURI == 0)
- URLS = new URLInputSource(XMLURL(uri));
- else
- URLS = new URLInputSource(XMLURL(XMLURL(mp_baseURI), uri));
+ if (mp_baseURI == 0) {
+ XSECnew(URLS, URLInputSource(XMLURL(uri)));
+ }
+ else {
+ XSECnew(URLS, URLInputSource(XMLURL(XMLURL(mp_baseURI), uri)));
+ }
// makeStream can (and is quite likely to) throw an exception
Janitor<URLInputSource> j_URLS(URLS);
is = URLS->makeStream();
-
- j_URLS.release();
-
- delete URLS;
if (is == NULL) {
1.10 +12 -9 xml-security/c/src/tools/checksig/checksig.cpp
Index: checksig.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/tools/checksig/checksig.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- checksig.cpp 23 Feb 2003 08:39:31 -0000 1.9
+++ checksig.cpp 1 Mar 2003 06:27:29 -0000 1.10
@@ -422,14 +422,6 @@
_CrtMemState s1, s2, s3;
- // Send all reports to STDOUT
- _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
- _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
- _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
-
// At this point we are about to start really using XSEC, so
// Take a "before" checkpoing
@@ -471,6 +463,17 @@
_CrtMemCheckpoint( &s2 );
if ( _CrtMemDifference( &s3, &s1, &s2 ) ) {
+
+ // Send all reports to STDOUT
+ _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
+ _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
+ _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
+ _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
+ _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
+ _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
+
+ // Dumpy memory stats
+
_CrtMemDumpAllObjectsSince( &s3 );
_CrtMemDumpStatistics( &s3 );
}
1.4 +8 -20 xml-security/c/src/tools/xtest/xtest.cpp
Index: xtest.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/tools/xtest/xtest.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xtest.cpp 22 Feb 2003 08:47:24 -0000 1.3
+++ xtest.cpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -65,12 +65,11 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
-
+
+#include <xsec/framework/XSECDefs.hpp>
#include <cassert>
@@ -84,7 +83,6 @@
#include <xercesc/framework/XMLFormatter.hpp>
#include <xercesc/dom/DOM.hpp>
-//#include <xercesc/dom/DOMParser.hpp>
#include <xercesc/util/XMLException.hpp>
#include <xsec/transformers/TXFMOutputFile.hpp>
@@ -96,17 +94,7 @@
#ifndef XSEC_NO_XALAN
-#include <Include/PlatformDefinitions.hpp>
-#include <XalanDOM/XalanDocument.hpp>
-#include <XercesParserLiaison/XercesDocumentBridge.hpp>
-#include <XalanDOM/XalanElement.hpp>
-#include <XPath/XObject.hpp>
#include <XPath/XPathEvaluator.hpp>
-#include <XPath/NodeRefList.hpp>
-#include <XPath/XalanXPathException.hpp>
-#include <XalanSourceTree/XalanSourceTreeDOMSupport.hpp>
-#include <XalanSourceTree/XalanSourceTreeInit.hpp>
-#include <XalanSourceTree/XalanSourceTreeParserLiaison.hpp>
#include <XalanTransformer/XalanTransformer.hpp>
XALAN_USING_XALAN(XPathEvaluator)
@@ -129,16 +117,16 @@
#include <xsec/dsig/DSIGKeyInfoX509.hpp>
#include <xsec/dsig/DSIGKeyInfoName.hpp>
-/*
- * Because of all the characters, it's easiest to put the entire program
- * in the Xerces namespace
- */
-
using std::ostream;
using std::cout;
using std::cerr;
using std::endl;
using std::flush;
+
+/*
+ * Because of all the characters, it's easiest to put the entire program
+ * in the Xerces namespace
+ */
XERCES_CPP_NAMESPACE_USE
1.5 +19 -1 xml-security/c/src/transformers/TXFMBase.hpp
Index: TXFMBase.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMBase.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TXFMBase.hpp 22 Feb 2003 08:47:24 -0000 1.4
+++ TXFMBase.hpp 1 Mar 2003 06:27:29 -0000 1.5
@@ -84,6 +84,22 @@
class TXFMChain;
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Base class for transformers
+ *
+ * Transformers are internal classes within the xml-security-c library
+ * that actually perform the transformations.
+ *
+ * Users interface with the library should use the DSIGTransform classes,
+ * which define the DOM nodes and allow users to manipulate the actual
+ * transform defined.
+ */
+
+
class DSIG_EXPORT TXFMBase {
protected:
@@ -163,5 +179,7 @@
TXFMBase();
};
+
+/** @} */
#endif /* #define TXFMBASE_INCLUDE */
1.3 +2 -27 xml-security/c/src/transformers/TXFMBase64.cpp
Index: TXFMBase64.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMBase64.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TXFMBase64.cpp 9 Feb 2003 11:13:51 -0000 1.2
+++ TXFMBase64.cpp 1 Mar 2003 06:27:29 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -76,29 +74,6 @@
#include <xsec/utils/XSECPlatformUtils.hpp>
#include <xsec/framework/XSECException.hpp>
-// Local function
-
-unsigned int cleanBuffer(unsigned char *buf, unsigned int bytes) {
-
- // Take an input buffer and "clean" it so that we can handle the Base64 transform OK
-
- unsigned char dest[2050];
-
- unsigned int j = 0;
-
- for (unsigned int i = 0; i < bytes; ++i) {
-
- if (buf[i] != '\r' && buf[i] != '\n')
- dest[j++] = buf[i];
-
- }
-
- memcpy(buf, dest, j);
-
- return j;
-
-}
-
TXFMBase64::TXFMBase64(DOMDocument *doc) : TXFMBase(doc) {
m_complete = false; // Nothing yet to output
@@ -118,7 +93,7 @@
TXFMBase64::~TXFMBase64() {
- if (mp_b64)
+ if (mp_b64 != NULL)
delete mp_b64;
};
1.4 +9 -2 xml-security/c/src/transformers/TXFMBase64.hpp
Index: TXFMBase64.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMBase64.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TXFMBase64.hpp 22 Feb 2003 08:47:24 -0000 1.3
+++ TXFMBase64.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -73,7 +73,13 @@
#include <xsec/transformers/TXFMBase.hpp>
#include <xsec/enc/XSECCryptoBase64.hpp>
-// Openssl includes
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Transformer to handle base64 transforms
+ */
class DSIG_EXPORT TXFMBase64 : public TXFMBase {
@@ -111,3 +117,4 @@
TXFMBase64();
};
+/** @} */
1.5 +4 -4 xml-security/c/src/transformers/TXFMC14n.cpp
Index: TXFMC14n.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMC14n.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TXFMC14n.cpp 21 Feb 2003 11:53:08 -0000 1.4
+++ TXFMC14n.cpp 1 Mar 2003 06:27:29 -0000 1.5
@@ -120,7 +120,7 @@
case TXFMBase::DOM_NODE_DOCUMENT :
- mp_c14n = new XSECC14n20010315(input->getDocument());
+ XSECnew(mp_c14n, XSECC14n20010315(input->getDocument()));
// Expand name spaces
input->expandNameSpaces();
@@ -129,13 +129,13 @@
case TXFMBase::DOM_NODE_DOCUMENT_NODE :
case TXFMBase::DOM_NODE_DOCUMENT_FRAGMENT :
- mp_c14n = new XSECC14n20010315(input->getDocument(), input->getFragmentNode());
+ XSECnew(mp_c14n, XSECC14n20010315(input->getDocument(), input->getFragmentNode()));
input->expandNameSpaces();
break;
case TXFMBase::DOM_NODE_XPATH_NODESET :
- mp_c14n = new XSECC14n20010315(input->getDocument());
+ XSECnew(mp_c14n, XSECC14n20010315(input->getDocument()));
mp_c14n->setXPathMap(input->getXPathNodeList());
break;
1.4 +11 -1 xml-security/c/src/transformers/TXFMC14n.hpp
Index: TXFMC14n.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMC14n.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TXFMC14n.hpp 22 Feb 2003 08:47:24 -0000 1.3
+++ TXFMC14n.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -73,6 +73,14 @@
#include <xsec/canon/XSECC14n20010315.hpp>
#include <xsec/utils/XSECNameSpaceExpander.hpp>
+ /** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Transformer to handle canonicalisation transforms
+ */
+
class DSIG_EXPORT TXFMC14n : public TXFMBase {
private:
@@ -111,3 +119,5 @@
private:
TXFMC14n();
};
+
+/** @} */
1.2 +13 -1 xml-security/c/src/transformers/TXFMChain.hpp
Index: TXFMChain.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMChain.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TXFMChain.hpp 21 Feb 2003 11:53:08 -0000 1.1
+++ TXFMChain.hpp 1 Mar 2003 06:27:29 -0000 1.2
@@ -76,6 +76,16 @@
class TXFMBase;
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief A holder class to take care of a chain of internal
+ * transformer objects.
+ */
+
+
class DSIG_EXPORT TXFMChain {
public:
@@ -103,5 +113,7 @@
inline
TXFMBase * TXFMChain::getLastTxfm(void) {return mp_currentTxfm;}
+
+/** @} */
#endif /* TXFMCHAIN_INCLUDE */
1.3 +12 -3 xml-security/c/src/transformers/TXFMDocObject.hpp
Index: TXFMDocObject.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMDocObject.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TXFMDocObject.hpp 9 Feb 2003 11:13:51 -0000 1.2
+++ TXFMDocObject.hpp 1 Mar 2003 06:27:29 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -77,6 +75,15 @@
#include <xercesc/dom/DOM.hpp>
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Transformer that defines a document start to a transform chain
+ */
+
+
class DSIG_EXPORT TXFMDocObject : public TXFMBase {
public:
@@ -114,3 +121,5 @@
TXFMDocObject();
};
+
+/** @} */
1.3 +11 -3 xml-security/c/src/transformers/TXFMEnvelope.hpp
Index: TXFMEnvelope.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMEnvelope.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TXFMEnvelope.hpp 9 Feb 2003 11:13:51 -0000 1.2
+++ TXFMEnvelope.hpp 1 Mar 2003 06:27:29 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -79,6 +77,14 @@
#include <xercesc/dom/DOM.hpp>
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Transformer to handle envelope transforms
+ */
+
class DSIG_EXPORT TXFMEnvelope : public TXFMBase {
private:
@@ -115,3 +121,5 @@
private:
TXFMEnvelope();
};
+
+/** @} */
1.4 +17 -2 xml-security/c/src/transformers/TXFMOutputFile.hpp
Index: TXFMOutputFile.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMOutputFile.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TXFMOutputFile.hpp 22 Feb 2003 08:47:24 -0000 1.3
+++ TXFMOutputFile.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -78,6 +78,21 @@
using std::ofstream;
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Transformer to handle file output transforms
+ *
+ * This transformer simply reads from the input transform
+ * and passes the bytes to the transformer that reads from it.
+ *
+ * On the way through, the writes are written to an output
+ * stream (a file). This is primarily a debugging tool.
+ */
+
+
class DSIG_EXPORT TXFMOutputFile : public TXFMBase {
private:
@@ -114,6 +129,6 @@
TXFMOutputFile();
};
-
+/** @} */
#endif /* #define TXFMOUTPUTFILE_INCLUDE */
1.3 +19 -1 xml-security/c/src/transformers/TXFMParser.hpp
Index: TXFMParser.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMParser.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TXFMParser.hpp 21 Feb 2003 11:53:08 -0000 1.2
+++ TXFMParser.hpp 1 Mar 2003 06:27:29 -0000 1.3
@@ -73,6 +73,22 @@
#include <xsec/transformers/TXFMBase.hpp>
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Transformer to handle move between bytes and DOM
+ *
+ * THere is no "parser" transformation defined in DSIG, however there
+ * is a requirement to be able to move between a byte stream and
+ * a list of nodes. For example, if a ref URI points to an external
+ * document, and the first transformation on that document is an
+ * XPath expression, then the library uses this class to translate the
+ * BYTE stream to a DOM document.
+ */
+
+
class DSIG_EXPORT TXFMParser : public TXFMBase {
public:
@@ -111,5 +127,7 @@
DOMDocument * mp_parsedDoc;
};
+
+/** @} */
#endif /* #define TXFMPARSER_INCLUDE */
1.4 +9 -3 xml-security/c/src/transformers/TXFMSB.hpp
Index: TXFMSB.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMSB.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TXFMSB.hpp 22 Feb 2003 08:47:24 -0000 1.3
+++ TXFMSB.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -64,14 +64,20 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
#include <xsec/transformers/TXFMBase.hpp>
#include <xsec/utils/XSECSafeBuffer.hpp>
+
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Base transformer to start a chain from a safeBuffer
+ */
class DSIG_EXPORT TXFMSB : public TXFMBase {
1.4 +10 -3 xml-security/c/src/transformers/TXFMSHA1.hpp
Index: TXFMSHA1.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMSHA1.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TXFMSHA1.hpp 22 Feb 2003 08:47:24 -0000 1.3
+++ TXFMSHA1.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -75,6 +73,14 @@
#include <xsec/transformers/TXFMBase.hpp>
#include <xsec/enc/XSECCryptoProvider.hpp>
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Transformer to handle create a SHA-1 hash from a chain
+ */
+
class DSIG_EXPORT TXFMSHA1 : public TXFMBase {
private:
@@ -111,3 +117,4 @@
TXFMSHA1();
};
+/** @} */
1.4 +10 -1 xml-security/c/src/transformers/TXFMURL.hpp
Index: TXFMURL.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMURL.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TXFMURL.hpp 22 Feb 2003 08:47:24 -0000 1.3
+++ TXFMURL.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -75,6 +75,14 @@
#include <xercesc/util/BinInputStream.hpp>
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Base transformer for URL inputs to chains
+ */
+
class DSIG_EXPORT TXFMURL : public TXFMBase {
private:
@@ -111,3 +119,4 @@
private :
TXFMURL();
};
+/** @} */
1.7 +3 -2 xml-security/c/src/transformers/TXFMXPath.cpp
Index: TXFMXPath.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMXPath.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TXFMXPath.cpp 22 Feb 2003 08:47:24 -0000 1.6
+++ TXFMXPath.cpp 1 Mar 2003 06:27:29 -0000 1.7
@@ -226,7 +226,8 @@
TXFMXPath::~TXFMXPath() {
- delete formatter;
+ if (formatter != NULL)
+ delete formatter;
}
1.4 +11 -1 xml-security/c/src/transformers/TXFMXPath.hpp
Index: TXFMXPath.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMXPath.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TXFMXPath.hpp 17 Feb 2003 11:21:03 -0000 1.3
+++ TXFMXPath.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -99,6 +99,15 @@
#ifndef XSEC_NO_XPATH
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Transformer to handle XPath transforms
+ */
+
+
class DSIG_EXPORT TXFMXPath : public TXFMBase {
private:
@@ -146,3 +155,4 @@
};
#endif
+/** @} */
1.5 +7 -7 xml-security/c/src/transformers/TXFMXSL.cpp
Index: TXFMXSL.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMXSL.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TXFMXSL.cpp 22 Feb 2003 08:47:25 -0000 1.4
+++ TXFMXSL.cpp 1 Mar 2003 06:27:29 -0000 1.5
@@ -80,9 +80,11 @@
#include <xercesc/dom/DOMImplementationLS.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/framework/MemBufInputSource.hpp>
+#include <xercesc/util/Janitor.hpp>
XSEC_USING_XERCES(XercesDOMParser);
XSEC_USING_XERCES(MemBufInputSource);
+XSEC_USING_XERCES(Janitor);
#include <iostream>
#include <strstream>
@@ -199,8 +201,6 @@
// Set up iostreams for input
std::istrstream theXMLStream((char *) sbInDoc.rawBuffer(), strlen((char *) sbInDoc.rawBuffer()));
std::istrstream theXSLStream((char *) sbStyleSheet.rawBuffer(), strlen((char *) sbStyleSheet.rawBuffer()));
- //std::istringstream theXMLStream((char *) sbInDoc.rawBuffer(), strlen((char *) sbInDoc.rawBuffer()));
- //std::istringstream theXSLStream((char *) sbStyleSheet.rawBuffer(), strlen((char *) sbStyleSheet.rawBuffer()));
// Now resolve
@@ -215,6 +215,8 @@
// Now use xerces to "re parse" this back into a DOM_Nodes document
XercesDOMParser * parser = new XercesDOMParser;
+ Janitor<XercesDOMParser> j_parser(parser);
+
parser->setDoNamespaces(true);
parser->setCreateEntityReferenceNodes(true);
parser->setDoSchema(true);
@@ -222,6 +224,7 @@
// Create an input source
MemBufInputSource* memIS = new MemBufInputSource ((const XMLByte*) txoh.buffer.rawBuffer(), txoh.offset, "XSECMem");
+ Janitor<MemBufInputSource> j_memIS(memIS);
int errorCount = 0;
@@ -232,10 +235,7 @@
docOut = parser->adoptDocument();
- // Clean up
-
- delete memIS;
- delete parser;
+ // Janitors clean up
}
1.4 +11 -1 xml-security/c/src/transformers/TXFMXSL.hpp
Index: TXFMXSL.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/transformers/TXFMXSL.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TXFMXSL.hpp 22 Feb 2003 08:47:25 -0000 1.3
+++ TXFMXSL.hpp 1 Mar 2003 06:27:29 -0000 1.4
@@ -96,6 +96,14 @@
#ifndef XSEC_NO_XSLT
+/** @ingroup internal
+ * @{
+ */
+
+/**
+ * \brief Transformer to handle XSLT transforms
+ */
+
class DSIG_EXPORT TXFMXSL : public TXFMBase {
private:
@@ -152,5 +160,7 @@
TXFMXSL();
};
+
+/** @} */
#endif /* No XSLT */
1.4 +1 -0 xml-security/c/src/utils/XSECBinTXFMInputStream.hpp
Index: XSECBinTXFMInputStream.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/utils/XSECBinTXFMInputStream.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSECBinTXFMInputStream.hpp 21 Feb 2003 11:53:09 -0000 1.3
+++ XSECBinTXFMInputStream.hpp 1 Mar 2003 06:27:30 -0000 1.4
@@ -82,6 +82,7 @@
/**
* @defgroup interfaces Classes that interface applications to XML Security C.
+ *
* These classes and files provide interfaces to allow the XSEC library to link
* to other libraries or to allow other libraries/applications to interface
* to XSEC.
1.4 +64 -6 xml-security/c/src/utils/XSECPlatformUtils.hpp
Index: XSECPlatformUtils.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/utils/XSECPlatformUtils.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSECPlatformUtils.hpp 22 Feb 2003 08:47:26 -0000 1.3
+++ XSECPlatformUtils.hpp 1 Mar 2003 06:27:30 -0000 1.4
@@ -78,20 +78,78 @@
#include <stdio.h>
+/**
+ * @ingroup pubsig
+ * @{
+ */
+
+/**
+ * \brief High level library interface class.
+ *
+ * This class is used primarily to initialise the library and
+ * communicate high level parameters that will be common to all
+ * objects from the class in any given session.
+ *
+ * It is primarily a static class.
+ */
+
class DSIG_EXPORT XSECPlatformUtils {
public :
- // Static data used by all of XSEC
- static int initCount; // Initialised?
- static XSECCryptoProvider * g_cryptoProvider; // The provider we are using
+ /**
+ * \brief Number of times initialise has been called
+ *
+ * initCount can be read by any class or function to determine how
+ * many times the library has been initialised.
+ */
+
+ static int initCount;
+
+ /**
+ * \brief The main cryptographic provider
+ *
+ * This pointer can be used to determine the primary crypto
+ * provider registered in the library.
+ *
+ * Individual signatures can over-ride this default.
+ *
+ */
+
+ static XSECCryptoProvider * g_cryptoProvider;
- // Member functions
+
+ /**
+ * \Initialise the library
+ *
+ * <b>Must</b> be called prior to using any functions in the library.
+ *
+ * Primarily sets up static variables used by all classes in the
+ * library.
+ *
+ * @param p A pointer to a XSECCryptoProvider object that the library
+ * should use for cryptographic functions. If p == NULL, the library
+ * will instantiate an OpenSSLCryptoProvider object.
+ */
static void Initialise(XSECCryptoProvider * p = NULL);
+
+ /**
+ * \brief Terminate
+ *
+ * Should be called prior to any program exist to allow the library
+ * to cleanly delete any memory associated with the library as a whole.
+ *
+ * @note Do not call this function while any xml-security-c object
+ * remain instantiated. The results of doing so is undefined, and could
+ * cause bad results.
+ */
+
static void Terminate(void);
};
+
+/** @} */
#endif /* XSECPLATFORMUTILS_INCLUDE */
1.4 +25 -1 xml-security/c/src/utils/XSECSafeBuffer.hpp
Index: XSECSafeBuffer.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/utils/XSECSafeBuffer.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSECSafeBuffer.hpp 22 Feb 2003 08:47:26 -0000 1.3
+++ XSECSafeBuffer.hpp 1 Mar 2003 06:27:30 -0000 1.4
@@ -75,8 +75,30 @@
#include <xsec/framework/XSECDefs.hpp>
#include <xercesc/util/XMLString.hpp>
+/**
+ * \ingroup internal
+ * @{
+ */
+
+
#define DEFAULT_SAFE_BUFFER_SIZE 1024 // Default size for a safe Buffer
+ /**
+ *\brief Manage buffers of arbitrary size
+ *
+ * The safeBuffer class is used internally in the library
+ * to manage buffers of bytes or UTF-16 characters.
+ *
+ * It's a fairly innefficient class, as buffers are continually
+ * being wrapped, coppied and enlarged, but given the nature of the
+ * library, a single class that manipulates buffers of variable
+ * size was felt to be preferable,
+ *
+ * The safeBuffer is not exposed through interface classes that
+ * might be used by external functions. In these cases, a
+ * pointer to a XMLCh * buffer is used by preference.
+ */
+
class CANON_EXPORT safeBuffer {
public:
@@ -170,6 +192,8 @@
// For XMLCh manipulation
static size_t size_XMLCh;
};
+
+/** @} */
#endif /* XSECSAFEBUFFER_INCLUDE */
1.3 +13 -5 xml-security/c/src/utils/XSECSafeBufferFormatter.hpp
Index: XSECSafeBufferFormatter.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/utils/XSECSafeBufferFormatter.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECSafeBufferFormatter.hpp 9 Feb 2003 11:13:52 -0000 1.2
+++ XSECSafeBufferFormatter.hpp 1 Mar 2003 06:27:30 -0000 1.3
@@ -64,9 +64,7 @@
*
* Author(s): Berin Lautenbach
*
- * $ID$
- *
- * $LOG$
+ * $Id$
*
*/
@@ -84,6 +82,10 @@
XSEC_USING_XERCES(XMLFormatter);
XSEC_USING_XERCES(XMLFormatTarget);
+/** @ingroup internal
+ * @{
+ */
+
class sbFormatTarget : public XMLFormatTarget
{
public:
@@ -118,9 +120,13 @@
};
-// For easy copying to a buffer
+/**
+ * \brief Formatter for outputting to a safeBuffer
+ *
+ * The XSECSafeBufferFormatter class is used as an internal class
+ * to perform encoding translations with a safeBuffer as a target
+ */
-//XMLFormatter& operator<< (XMLFormatter& strm, const DOMString& s);
class XSECSafeBufferFormatter {
@@ -180,5 +186,7 @@
XSECSafeBufferFormatter() {};
};
+
+/** @} */
#endif /* XSECSAFEBUFFERFORMATTER_INCLUDE */
1.3 +2 -0 xml-security/c/src/utils/XSECXPathNodeList.cpp
Index: XSECXPathNodeList.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/utils/XSECXPathNodeList.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSECXPathNodeList.cpp 9 Feb 2003 11:13:52 -0000 1.2
+++ XSECXPathNodeList.cpp 1 Mar 2003 06:27:30 -0000 1.3
@@ -194,6 +194,8 @@
else if (mp_last == NULL) {
+ delete tmp;
+
throw XSECException(XSECException::InternalError,
"XSECXPathNodeList has an element that is incorrectly linked");