Qt Library Paths:
/usr/lib/qt4/plugins
/usr/local/bin
plugin: Checking Qt static plugins:
plugin: (none)
plugin: Checking Qt Library Path: /usr/lib/qt4/plugins
plugin: libqca-ossl.so: (class: opensslPlugin) loaded as qca-ossl
plugin: libqca-ossl.so.debug: not a library, skipping
plugin: Checking Qt Library Path: /usr/local/bin
plugin: (No 'crypto' subdirectory)
Available Providers:
qca-ossl
This product includes cryptographic software written by Eric Young
(eay@cryptsoft.com)
*sha1
*sha0
*ripemd160
*md4
*md5
*sha224
*sha256
*sha384
*sha512
*hmac(md5)
*hmac(sha1)
*hmac(sha224)
*hmac(sha256)
*hmac(sha384)
*hmac(sha512)
*hmac(ripemd160)
*aes128-ecb
*aes128-cfb
*aes128-cbc
*aes128-cbc-pkcs7
*aes128-ofb
*aes192-ecb
*aes192-cfb
*aes192-cbc
*aes192-cbc-pkcs7
*aes192-ofb
*aes256-ecb
*aes256-cbc
*aes256-cbc-pkcs7
*aes256-cfb
*aes256-ofb
*blowfish-ecb
*blowfish-cbc-pkcs7
*blowfish-cbc
*blowfish-cfb
*blowfish-ofb
*tripledes-ecb
*tripledes-cbc
*des-ecb
*des-ecb-pkcs7
*des-cbc
*des-cbc-pkcs7
*des-cfb
*des-ofb
*cast5-ecb
*cast5-cbc
*cast5-cbc-pkcs7
*cast5-cfb
*cast5-ofb
*pbkdf1(sha1)
*pbkdf2(sha1)
*pkey
*dlgroup
*rsa
*dsa
*dh
*cert
*csr
*crl
*certcollection
*pkcs12
*tls
*cms
*ca
plugin: Unloaded: qca-ossl
Qt Library Paths:
/usr/lib/qt4/plugins
/usr/local/bin
plugin: Checking Qt static plugins:
plugin: (none)
plugin: Checking Qt Library Path: /usr/lib/qt4/plugins
plugin: libqca-ossl.so: (class: opensslPlugin) loaded as qca-ossl
plugin: libqca-ossl.so.debug: not a library, skipping
plugin: Checking Qt Library Path: /usr/local/bin
plugin: (No 'crypto' subdirectory)
Available Providers:
qca-ossl
This product includes cryptographic software written by Eric Young
(eay@cryptsoft.com)
*sha1
*sha0
*ripemd160
*md4
*md5
*sha224
*sha256
*sha384
*sha512
*hmac(md5)
*hmac(sha1)
*hmac(sha224)
*hmac(sha256)
*hmac(sha384)
*hmac(sha512)
*hmac(ripemd160)
*aes128-ecb
*aes128-cfb
*aes128-cbc
*aes128-cbc-pkcs7
*aes128-ofb
*aes192-ecb
*aes192-cfb
*aes192-cbc
*aes192-cbc-pkcs7
*aes192-ofb
*aes256-ecb
*aes256-cbc
*aes256-cbc-pkcs7
*aes256-cfb
*aes256-ofb
*blowfish-ecb
*blowfish-cbc-pkcs7
*blowfish-cbc
*blowfish-cfb
*blowfish-ofb
*tripledes-ecb
*tripledes-cbc
*des-ecb
*des-ecb-pkcs7
*des-cbc
*des-cbc-pkcs7
*des-cfb
*des-ofb
*cast5-ecb
*cast5-cbc
*cast5-cbc-pkcs7
*cast5-cfb
*cast5-ofb
*pbkdf1(sha1)
*pbkdf2(sha1)
*pkey
*dlgroup
*rsa
*dsa
*dh
*cert
*csr
*crl
*certcollection
*pkcs12
*tls
*cms
*ca
plugin: Unloaded: qca-ossl
To copy to clipboard, switch view to plain text mode
#include <QtCrypto>
#include <QDebug>
#include <cstdio>
int main(int argc, char **argv)
{
QCA::Initializer init;
QCA::SecureArray arg = (argc >= 2) ? argv[1] : "hello";
if(!QCA::isSupported("aes128-cbc-pkcs7"))
printf("AES128-CBC not supported!\n");
else {
QCA::SymmetricKey key(16);
QCA::InitializationVector iv(16);
QCA
::Cipher cipher
(QString("aes128"),QCA
::Cipher::CBC, QCA
::Cipher::DefaultPadding,QCA
::Encode,key,iv
);
QCA::SecureArray u = cipher.update(arg);
if (!cipher.ok())
{
printf("Update failed\n");
}
printf("AES128 encryption of %s is [%s]\n",arg.data(),qPrintable(QCA::arrayToHex(u.toByteArray())) );
QCA::SecureArray f = cipher.final();
if (!cipher.ok())
{
printf("Final failed\n");
}
printf("Final block for AES128 encryption is [0x%s]\n", qPrintable(QCA::arrayToHex(f.toByteArray())) );
cipher.setup( QCA::Decode, key, iv );
QCA::SecureArray cipherText = u.append(f);
QCA::SecureArray plainText = cipher.update(cipherText);
if (!cipher.ok())
{
printf("Update failed\n");
}
printf("Decryption using AES128 of [0x%s] is %s\n",qPrintable(QCA::arrayToHex(cipherText.toByteArray())), plainText.data());
plainText = cipher.final();
if (!cipher.ok())
{
printf("Final failed\n");
}
printf("Final decryption block using AES128 is %s\n", plainText.data());
printf("One step decryption using AES128: %s\n",QCA::SecureArray(cipher.process(cipherText)).data() );
}
return 0;
}
#include <QtCrypto>
#include <QDebug>
#include <cstdio>
int main(int argc, char **argv)
{
QCA::Initializer init;
QCA::SecureArray arg = (argc >= 2) ? argv[1] : "hello";
if(!QCA::isSupported("aes128-cbc-pkcs7"))
printf("AES128-CBC not supported!\n");
else {
QCA::SymmetricKey key(16);
QCA::InitializationVector iv(16);
QCA::Cipher cipher(QString("aes128"),QCA::Cipher::CBC, QCA::Cipher::DefaultPadding,QCA::Encode,key,iv);
QCA::SecureArray u = cipher.update(arg);
if (!cipher.ok())
{
printf("Update failed\n");
}
printf("AES128 encryption of %s is [%s]\n",arg.data(),qPrintable(QCA::arrayToHex(u.toByteArray())) );
QCA::SecureArray f = cipher.final();
if (!cipher.ok())
{
printf("Final failed\n");
}
printf("Final block for AES128 encryption is [0x%s]\n", qPrintable(QCA::arrayToHex(f.toByteArray())) );
cipher.setup( QCA::Decode, key, iv );
QCA::SecureArray cipherText = u.append(f);
QCA::SecureArray plainText = cipher.update(cipherText);
if (!cipher.ok())
{
printf("Update failed\n");
}
printf("Decryption using AES128 of [0x%s] is %s\n",qPrintable(QCA::arrayToHex(cipherText.toByteArray())), plainText.data());
plainText = cipher.final();
if (!cipher.ok())
{
printf("Final failed\n");
}
printf("Final decryption block using AES128 is %s\n", plainText.data());
printf("One step decryption using AES128: %s\n",QCA::SecureArray(cipher.process(cipherText)).data() );
}
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks