You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by sc...@apache.org on 2013/05/03 03:34:22 UTC

svn commit: r1478626 - /santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp

Author: scantor
Date: Fri May  3 01:34:21 2013
New Revision: 1478626

URL: http://svn.apache.org/r1478626
Log:
Remove dead code.

Modified:
    santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp

Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp?rev=1478626&r1=1478625&r2=1478626&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGSignature.cpp Fri May  3 01:34:21 2013
@@ -111,152 +111,6 @@ void DSIGSignature::Initialise(void) {
 
 }
 
-// --------------------------------------------------------------------------------
-//           Some useful utility functions
-// --------------------------------------------------------------------------------
-
-
-#if 0
-
-bool compareBase64StringToRaw(safeBuffer &b64SB, 
-							  unsigned char * raw, 
-							  unsigned int rawLen, 
-							  unsigned int maxCompare = 0) {
-	// Decode a base64 buffer and then compare the result to a raw buffer
-	// Compare at most maxCompare bits (if maxComare > 0)
-	// Note - whilst the other parameters are bytes, maxCompare is bits
-
-	unsigned char outputStr[1024];
-	unsigned char b64Str[1024];
-	unsigned int outputLen = 0;
-	
-	XSECCryptoBase64 * b64 = XSECPlatformUtils::g_cryptoProvider->base64();
-	
-	if (!b64) {
-
-		throw XSECException(XSECException::CryptoProviderError, 
-				"Error requesting Base64 object from Crypto Provider");
-
-	}
-
-	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, (unsigned int) strlen((char *) b64Str), outputStr, 1024);
-	outputLen += b64->decodeFinish(&outputStr[outputLen], 1024 - outputLen);
-
-	// Compare
-
-	div_t d;
-	unsigned int maxCompareBytes, maxCompareBits;
-	maxCompareBits = 0;
-
-	unsigned int size;
-
-	if (maxCompare > 0) {
-		d = div(maxCompare, 8);
-		maxCompareBytes = d.quot;
-		if (d.rem != 0)
-			maxCompareBytes++;
-
-		if (rawLen < maxCompareBytes && outputLen < maxCompareBytes) {
-			if (rawLen != outputLen)
-				return false;
-			size = rawLen;
-		}
-		else if (rawLen < maxCompareBytes || outputLen < maxCompareBytes) {
-			return false;
-		}
-		else
-			size = maxCompareBytes;
-	}
-	else {
-
-		if (rawLen != outputLen)
-			return false;
-
-		size = rawLen;
-
-	}
-
-	// Compare bytes
-	unsigned int i, j;
-	for (i = 0; i < size; ++ i) {
-		if (raw[i] != outputStr[i])
-			return false;
-	}
-
-	// Compare bits
-
-	char mask = 0x01;
-	if (maxCompare != 0) {
-	    for (j = 0 ; j < (unsigned int) d.rem; ++i) {
-
-		    if ((raw[i] & mask) != (outputStr[i] & mask))
-			    return false;
-
-			mask = mask << 1;
-		}
-	}
-
-	return true;
-
-}
-
-
-void convertRawToBase64String(safeBuffer &b64SB, 
-							  unsigned char * raw, 
-							  unsigned int rawLen, 
-							  unsigned int maxBits = 0) {
-
-	// Translate the rawbuffer (at most maxBits or rawLen - whichever is smaller)
-	// to a base64 string
-
-	unsigned char b64Str[1024];
-	unsigned int outputLen = 0;
-	
-	XSECCryptoBase64 * b64 = XSECPlatformUtils::g_cryptoProvider->base64();
-	
-	if (!b64) {
-
-		throw XSECException(XSECException::CryptoProviderError, 
-				"Error requesting Base64 object from Crypto Provider");
-
-	}
-
-	Janitor<XSECCryptoBase64> j_b64(b64);
-
-	// Determine length to translate
-	unsigned int size;
-
-	if (maxBits > 0) {
-		div_t d = div(maxBits, 8);
-		size = d.quot;
-		if (d.rem != 0)
-			++size;
-		
-		if (size > rawLen)
-			size = rawLen;
-	}
-
-	else
-		size = rawLen;
-
-	b64->encodeInit();
-	outputLen = b64->encode((unsigned char *) raw, rawLen, b64Str, 1024);
-	outputLen += b64->encodeFinish(&b64Str[outputLen], 1024 - outputLen);
-	b64Str[outputLen] = '\0';
-
-	// Copy out
-
-	b64SB.sbStrcpyIn((char *) b64Str);
-
-}
-
-#endif /* 0 */
 
 // --------------------------------------------------------------------------------
 //           Get the Canonicalised BYTE_STREAM of the SignedInfo