Skip to content

Commit 6620509

Browse files
committed
porting rev.1912 from 1.4.4 (fixed SF# 3552597)
1 parent e7f2ade commit 6620509

5 files changed

Lines changed: 35 additions & 2 deletions

File tree

Crypto/src/CipherImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ namespace
116116
&_ctx,
117117
_pCipher,
118118
&_key[0],
119-
&_iv[0],
119+
_iv.empty() ? 0 : &_iv[0],
120120
(dir == DIR_ENCRYPT) ? 1 : 0);
121121
}
122122

Crypto/testsuite/src/CryptoTest.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
148178
void 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

Crypto/testsuite/src/CryptoTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class CryptoTest: public CppUnit::TestCase
5353

5454
void testEncryptDecrypt();
5555
void testEncryptDecryptWithSalt();
56+
void testEncryptDecryptDESECB();
5657
void testStreams();
5758
void testCertificate();
5859

Foundation/include/Poco/FileChannel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class Foundation_API FileChannel: public Channel
155155
/// The purgeAge property can have the following values:
156156
///
157157
/// * "none" or "" no purging
158-
/// * <n> [seconds] the maximum age is <n> seconds.
158+
/// * <n> [seconds]: the maximum age is <n> seconds.
159159
/// * <n> minutes: the maximum age is <n> minutes.
160160
/// * <n> hours: the maximum age is <n> hours.
161161
/// * <n> days: the maximum age is <n> days.

NetSSL_OpenSSL/src/SecureSocketImpl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ void SecureSocketImpl::shutdown()
241241
// done with it.
242242
int rc = SSL_shutdown(_pSSL);
243243
if (rc < 0) handleError(rc);
244+
if (_pSocket->getBlocking()) _pSocket->shutdown();
244245
}
245246
}
246247
}

0 commit comments

Comments
 (0)