Encryption
-
Hi there.
The question is about string encryption and decryption? Some like QCA is too big to use. Have you ever seen anything to work AES or 3DES over OpenSSL?
Just couple of methods like this:
QString encrypt(const QString &data, const QString &key);
QString decrypt(const QString &data, const QString &key); -
why not QCryptographicHash? May be hashing heps you than encrypt and decrypt.
-
It is required to store encrypted password and decrypt it for server authentication.
-
Ok. Then QCryptographicHash wil not hep as far as i know, since it can ony work one way...On symbian, use can use the native interfaces http://wiki.forum.nokia.com/index.ph...ptography_APIs
-
Sorry, but at first your link invalid and at second we on desktop.
-
Ok, now we have something like "this":http://ompldr.org/vN2cxdg/aes.tar.bz2 for AES, but with unknown license. I remake it from "this":http://www.softwarematrix.cn/blog/misc/using-openssl-in-cpp.
-
Thank you!
-
I use "Botan":https://github.com/randombit/botan for Encryption, please see my "blog post":http://onethingor2.blogspot.tw/search/label/Botan on how to compile botan to an library.
One the library is compiled, includes the lib and header. Then code would look like this.
@QString hash = QString("PRIVATE_KEY") + QString("PUBLIC_KEY");
const bool ok = Botan::check_bcrypt(hash.toStdString(), "$2a$10$.POxJepIUGgMNR/wqgdjOuEd2sz9ag5Qo84/U7lpMceXVktsaXGZ2");
qDebug() << "Is KEY OK ?" << ok;@Or Something like this for DES Encryption
@SecureVector<byte> encrypt(const byte* msg, const SymmetricKey& key) {
Pipe pipe(get_cipher("DES/CBC", key, ENCRYPTION));
pipe.start_msg();
pipe.write(msg, strlen((const char*) msg));
pipe.end_msg();
return pipe.read_all();
}std::string decrypt(const SecureVector<byte>& msg, const SymmetricKey& key) {
Pipe pipe(get_cipher("DES/CBC", key, DECRYPTION));
pipe.start_msg();
pipe.write(msg);
pipe.end_msg();
return pipe.read_all_as_string();
}@ -
An old thread, but one point that might help anyone landing here from a search: before jumping into AES or 3DES via Botan/QCryptographicHash, it is worth being clear about what problem you actually have. QCryptographicHash is a one-way hash (as noted above), so it cannot help when you need to recover the plaintext for server authentication — for that you need a reversible cipher, and you should avoid rolling your own crypto for real credentials.
If you just want to explore how ciphers work, I maintain a small free educational site, CaesarCipher.org, with browser-based encoders, decoders and solvers for classical ciphers (Caesar, Vigenere, Atbash, ROT13) plus a cipher identifier and Base64/hex converters. Everything runs locally in the browser, no signup. It is a teaching aid, not a replacement for a vetted library like Botan in production code — but it is handy for demonstrating substitution, frequency analysis and shift/brute-force concepts to students or when debugging your own toy implementation.