Update padding check logic
parent
f817fc7c2e
commit
3b4a9e2ccf
17
filters.cpp
17
filters.cpp
|
|
@ -611,14 +611,15 @@ void StreamTransformationFilter::InitializeDerivedAndReturnNewSizes(const NameVa
|
||||||
else
|
else
|
||||||
m_padding = padding;
|
m_padding = padding;
|
||||||
|
|
||||||
if (!isBlockCipher && (m_padding == PKCS_PADDING))
|
if (!isBlockCipher)
|
||||||
throw InvalidArgument("StreamTransformationFilter: PKCS_PADDING cannot be used with " + m_cipher.AlgorithmName());
|
{
|
||||||
|
if (m_padding == PKCS_PADDING)
|
||||||
if (!isBlockCipher && (m_padding == W3C_PADDING))
|
throw InvalidArgument("StreamTransformationFilter: PKCS_PADDING cannot be used with " + m_cipher.AlgorithmName());
|
||||||
throw InvalidArgument("StreamTransformationFilter: W3C_PADDING cannot be used with " + m_cipher.AlgorithmName());
|
else if (m_padding == W3C_PADDING)
|
||||||
|
throw InvalidArgument("StreamTransformationFilter: W3C_PADDING cannot be used with " + m_cipher.AlgorithmName());
|
||||||
if (!isBlockCipher && (m_padding == ONE_AND_ZEROS_PADDING))
|
else if (m_padding == ONE_AND_ZEROS_PADDING)
|
||||||
throw InvalidArgument("StreamTransformationFilter: ONE_AND_ZEROS_PADDING cannot be used with " + m_cipher.AlgorithmName());
|
throw InvalidArgument("StreamTransformationFilter: ONE_AND_ZEROS_PADDING cannot be used with " + m_cipher.AlgorithmName());
|
||||||
|
}
|
||||||
|
|
||||||
firstSize = 0;
|
firstSize = 0;
|
||||||
blockSize = m_cipher.MandatoryBlockSize();
|
blockSize = m_cipher.MandatoryBlockSize();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue