mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 14:24:35 +01:00
porting rev.1912 from 1.4.4 (fixed SF# 3552597)
This commit is contained in:
parent
e7f2ade581
commit
662050937e
@ -116,7 +116,7 @@ namespace
|
||||
&_ctx,
|
||||
_pCipher,
|
||||
&_key[0],
|
||||
&_iv[0],
|
||||
_iv.empty() ? 0 : &_iv[0],
|
||||
(dir == DIR_ENCRYPT) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,36 @@ void CryptoTest::testEncryptDecryptWithSalt()
|
||||
}
|
||||
|
||||
|
||||
void CryptoTest::testEncryptDecryptDESECB()
|
||||
{
|
||||
Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(CipherKey("des-ecb", "password"));
|
||||
|
||||
for (std::size_t n = 1; n < MAX_DATA_SIZE; n++)
|
||||
{
|
||||
std::string in(n, 'x');
|
||||
std::string out = pCipher->encryptString(in, Cipher::ENC_NONE);
|
||||
std::string result = pCipher->decryptString(out, Cipher::ENC_NONE);
|
||||
poco_assert (in == result);
|
||||
}
|
||||
|
||||
for (std::size_t n = 1; n < MAX_DATA_SIZE; n++)
|
||||
{
|
||||
std::string in(n, 'x');
|
||||
std::string out = pCipher->encryptString(in, Cipher::ENC_BASE64);
|
||||
std::string result = pCipher->decryptString(out, Cipher::ENC_BASE64);
|
||||
poco_assert (in == result);
|
||||
}
|
||||
|
||||
for (std::size_t n = 1; n < MAX_DATA_SIZE; n++)
|
||||
{
|
||||
std::string in(n, 'x');
|
||||
std::string out = pCipher->encryptString(in, Cipher::ENC_BINHEX);
|
||||
std::string result = pCipher->decryptString(out, Cipher::ENC_BINHEX);
|
||||
poco_assert (in == result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CryptoTest::testStreams()
|
||||
{
|
||||
Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(CipherKey("aes256"));
|
||||
@ -218,6 +248,7 @@ CppUnit::Test* CryptoTest::suite()
|
||||
|
||||
CppUnit_addTest(pSuite, CryptoTest, testEncryptDecrypt);
|
||||
CppUnit_addTest(pSuite, CryptoTest, testEncryptDecryptWithSalt);
|
||||
CppUnit_addTest(pSuite, CryptoTest, testEncryptDecryptDESECB);
|
||||
CppUnit_addTest(pSuite, CryptoTest, testStreams);
|
||||
CppUnit_addTest(pSuite, CryptoTest, testCertificate);
|
||||
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
|
||||
void testEncryptDecrypt();
|
||||
void testEncryptDecryptWithSalt();
|
||||
void testEncryptDecryptDESECB();
|
||||
void testStreams();
|
||||
void testCertificate();
|
||||
|
||||
|
@ -155,7 +155,7 @@ class Foundation_API FileChannel: public Channel
|
||||
/// The purgeAge property can have the following values:
|
||||
///
|
||||
/// * "none" or "" no purging
|
||||
/// * <n> [seconds] the maximum age is <n> seconds.
|
||||
/// * <n> [seconds]: the maximum age is <n> seconds.
|
||||
/// * <n> minutes: the maximum age is <n> minutes.
|
||||
/// * <n> hours: the maximum age is <n> hours.
|
||||
/// * <n> days: the maximum age is <n> days.
|
||||
|
@ -241,6 +241,7 @@ void SecureSocketImpl::shutdown()
|
||||
// done with it.
|
||||
int rc = SSL_shutdown(_pSSL);
|
||||
if (rc < 0) handleError(rc);
|
||||
if (_pSocket->getBlocking()) _pSocket->shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user