@@ -145,6 +145,36 @@ void CryptoTest::testEncryptDecryptWithSalt()
145145}
146146
147147
148+ void CryptoTest::testEncryptDecryptDESECB ()
149+ {
150+ Cipher::Ptr pCipher = CipherFactory::defaultFactory ().createCipher (CipherKey (" des-ecb" , " password" ));
151+
152+ for (std::size_t n = 1 ; n < MAX_DATA_SIZE; n++)
153+ {
154+ std::string in (n, ' x' );
155+ std::string out = pCipher->encryptString (in, Cipher::ENC_NONE);
156+ std::string result = pCipher->decryptString (out, Cipher::ENC_NONE);
157+ poco_assert (in == result);
158+ }
159+
160+ for (std::size_t n = 1 ; n < MAX_DATA_SIZE; n++)
161+ {
162+ std::string in (n, ' x' );
163+ std::string out = pCipher->encryptString (in, Cipher::ENC_BASE64);
164+ std::string result = pCipher->decryptString (out, Cipher::ENC_BASE64);
165+ poco_assert (in == result);
166+ }
167+
168+ for (std::size_t n = 1 ; n < MAX_DATA_SIZE; n++)
169+ {
170+ std::string in (n, ' x' );
171+ std::string out = pCipher->encryptString (in, Cipher::ENC_BINHEX);
172+ std::string result = pCipher->decryptString (out, Cipher::ENC_BINHEX);
173+ poco_assert (in == result);
174+ }
175+ }
176+
177+
148178void CryptoTest::testStreams ()
149179{
150180 Cipher::Ptr pCipher = CipherFactory::defaultFactory ().createCipher (CipherKey (" aes256" ));
@@ -218,6 +248,7 @@ CppUnit::Test* CryptoTest::suite()
218248
219249 CppUnit_addTest (pSuite, CryptoTest, testEncryptDecrypt);
220250 CppUnit_addTest (pSuite, CryptoTest, testEncryptDecryptWithSalt);
251+ CppUnit_addTest (pSuite, CryptoTest, testEncryptDecryptDESECB);
221252 CppUnit_addTest (pSuite, CryptoTest, testStreams);
222253 CppUnit_addTest (pSuite, CryptoTest, testCertificate);
223254
0 commit comments