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 2012/08/21 20:01:32 UTC
svn commit: r1375699 -
/santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp
Author: scantor
Date: Tue Aug 21 18:01:32 2012
New Revision: 1375699
URL: http://svn.apache.org/viewvc?rev=1375699&view=rev
Log:
SANTUARIO-340 - Key creation should check for invalid key size.
Modified:
santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp
Modified: santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp?rev=1375699&r1=1375698&r2=1375699&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp Tue Aug 21 18:01:32 2012
@@ -1133,24 +1133,27 @@ XSECCryptoKey * XENCAlgorithmHandlerDefa
XSECCryptoSymmetricKey * sk = NULL;
if (strEquals(uri, DSIGConstants::s_unicodeStrURI3DES_CBC)) {
+ if (keyLen != 192)
+ throw XSECException(XSECException::CipherError,
+ "XENCAlgorithmHandlerDefault - key size was invalid");
sk = XSECPlatformUtils::g_cryptoProvider->keySymmetric(XSECCryptoSymmetricKey::KEY_3DES_192);
}
- else if (strEquals(uri, DSIGConstants::s_unicodeStrURIAES128_CBC)) {
+ else if (strEquals(uri, DSIGConstants::s_unicodeStrURIAES128_CBC) || strEquals(uri, DSIGConstants::s_unicodeStrURIAES128_GCM)) {
+ if (keyLen != 128)
+ throw XSECException(XSECException::CipherError,
+ "XENCAlgorithmHandlerDefault - key size was invalid");
sk = XSECPlatformUtils::g_cryptoProvider->keySymmetric(XSECCryptoSymmetricKey::KEY_AES_128);
}
- else if (strEquals(uri, DSIGConstants::s_unicodeStrURIAES192_CBC)) {
+ else if (strEquals(uri, DSIGConstants::s_unicodeStrURIAES192_CBC) || strEquals(uri, DSIGConstants::s_unicodeStrURIAES192_GCM)) {
+ if (keyLen != 192)
+ throw XSECException(XSECException::CipherError,
+ "XENCAlgorithmHandlerDefault - key size was invalid");
sk = XSECPlatformUtils::g_cryptoProvider->keySymmetric(XSECCryptoSymmetricKey::KEY_AES_192);
}
- else if (strEquals(uri, DSIGConstants::s_unicodeStrURIAES256_CBC)) {
- sk = XSECPlatformUtils::g_cryptoProvider->keySymmetric(XSECCryptoSymmetricKey::KEY_AES_256);
- }
- else if (strEquals(uri, DSIGConstants::s_unicodeStrURIAES128_GCM)) {
- sk = XSECPlatformUtils::g_cryptoProvider->keySymmetric(XSECCryptoSymmetricKey::KEY_AES_128);
- }
- else if (strEquals(uri, DSIGConstants::s_unicodeStrURIAES192_GCM)) {
- sk = XSECPlatformUtils::g_cryptoProvider->keySymmetric(XSECCryptoSymmetricKey::KEY_AES_192);
- }
- else if (strEquals(uri, DSIGConstants::s_unicodeStrURIAES256_GCM)) {
+ else if (strEquals(uri, DSIGConstants::s_unicodeStrURIAES256_CBC) || strEquals(uri, DSIGConstants::s_unicodeStrURIAES256_GCM)) {
+ if (keyLen != 256)
+ throw XSECException(XSECException::CipherError,
+ "XENCAlgorithmHandlerDefault - key size was invalid");
sk = XSECPlatformUtils::g_cryptoProvider->keySymmetric(XSECCryptoSymmetricKey::KEY_AES_256);
}