crypto++

How to perform unpadding after decryption of stream using CryptoPP

↘锁芯ラ 提交于 2019-12-08 08:00:08
问题 I've got the stream to decrypt. I divide it into blocks and pass each block to the method below. The data I need to decrypt is encrypted by 16 - bytes blocks and if the last block is less than 16, then all the rest bytes are filled by padding. Then in the moment of decryption I'm getting my last block result as the value including these additional padding bytes. How can I determine the length of original data and return only it or determine the padding bytes and remove them, considering

How to easily apply Crypto++ hash functions?

只愿长相守 提交于 2019-12-08 02:43:40
问题 Can someone help me how can I easily use hash functions from Crypto++ library? I tried used these codes for SHA1 and MD5. I have many errors on line where is StringSink . The errors are like: undefined reference to `CryptoPP::StringSinkTemplate::StringSinkTemplate(std::string&)' Thanks for help. // SHA CryptoPP::SHA1 sha1; std::string source = "Hello"; std::string hash = ""; CryptoPP::StringSource(source, true, new CryptoPP::HashFilter(sha1, new CryptoPP::HexEncoder(new CryptoPP::StringSink

How to seek in CTR mode and decrypt part of the stream?

若如初见. 提交于 2019-12-08 01:36:49
问题 I have a question in partial decoding in cryptopp. USE AES 256 CTR; Encode source: CTR_Mode< AES >::Encryption e; e.SetKeyWithIV(key, 32, iv); string encrypt; string a = "Example text to encoding"; encrypt.clear(); StringSource s(a, true, new StreamTransformationFilter(e, new StringSink(encrypt) ) ); Decode source: CTR_Mode<AES>::Decryption d; d.SetKeyWithIV(key, 32, iv); string x; StringSource s1(encrypt, true, new StreamTransformationFilter(d, new StringSink(x) ) ); It works fine. But I don

Key agreement with XTR-DH Crypto++

守給你的承諾、 提交于 2019-12-07 18:44:49
问题 I try applied XTR-DH for Key Agreement with this example: ////////////////////////////////////////////////////////////////////////// // Alice // Initialize the Diffie-Hellman class with a random prime and base AutoSeededRandomPool rngA; DH dhA; dh.Initialize(rngA, 128); // Extract the prime and base. These values could also have been hard coded // in the application Integer iPrime = dhA.GetGroupParameters().GetModulus(); Integer iGenerator = dhA.GetGroupParameters().GetSubgroupGenerator();

Crypto++ can't build Qt Application

你。 提交于 2019-12-07 18:24:57
问题 I am currently trying to run Crypto++ in my Qt Application. But it does not work. Hopefully somebody of you knows whats wrong, because I have not figured it out and I am on this for 3 days now. To concentrate the problem, I have created a test app. Holding this code: http://pastebin.com/1XMARtds taken from http://programmingknowledgeblog.blogspot.de/2013/04/compiling-and-integrating-crypto-into.html My .pro looks like this: TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt

RSA signature in c# and verification in C++ with Crypto++

柔情痞子 提交于 2019-12-07 13:33:21
问题 I'm trying to sign some bytes in C# thanks to the class RSACryptoServiceProvider and to verify it in C++ with the Crypto++ library. Despite all my attempts, the validation fail although I'm sure of my key and signature. In C# I sign as follow : var message = "hello"; var bytes = System.Text.Encoding.UTF8.GetBytes(message); byte[] signedHash; using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider()) { // Import the key information. rsa.ImportParameters(privateKey); // Sign the data

How to perform unpadding after decryption of stream using CryptoPP

纵然是瞬间 提交于 2019-12-07 09:17:25
I've got the stream to decrypt. I divide it into blocks and pass each block to the method below. The data I need to decrypt is encrypted by 16 - bytes blocks and if the last block is less than 16, then all the rest bytes are filled by padding. Then in the moment of decryption I'm getting my last block result as the value including these additional padding bytes. How can I determine the length of original data and return only it or determine the padding bytes and remove them, considering different paddings could be used? void SymmetricAlgorithm::Decrypt(byte* buffer, size_t dataBytesSize) {

library not found due to targetSdkVersion (armeabi-v7a and libcryptopp.so)

≡放荡痞女 提交于 2019-12-07 05:24:16
问题 I have created a sample project that uses Crypto++'s native C++ Libraries and the NDK to generate some ECDH key pairs. You can find the project here. This project runs perfectly fine on most android devices (ran on a handful of 4.4 and 5.0 devices). However I recently ran the app on a Nexus 5 and Nexus 7, both running Android 6.0.1, and the app crashed with the following error. java.lang.UnsatisfiedLinkError: dlopen failed: library "./obj/local/armeabi-v7a/libcryptopp.so" not found I am not

Crypto++ to PHP mcrypt not working

时间秒杀一切 提交于 2019-12-06 12:20:42
问题 I have a C++ application that's using Crypto++ to send encrypted data to a PHP site. However, when the data's getting to the PHP side, it's not decrypting the data properly. The C++ / Crypto++ code: char stupidKey[AES::MAX_KEYLENGTH] = "thisisastupidkeythisisastupidke"; ECB_Mode<AES>::Encryption aes((byte *)stupidKey, AES::MAX_KEYLENGTH); std::string cypher; StringSource(aData, true, new StreamTransformationFilter(aes, new StringSink( cypher ))); StringSource(cypher, true, new Base64Encoder(

How to easily apply Crypto++ hash functions?

冷暖自知 提交于 2019-12-06 11:37:16
Can someone help me how can I easily use hash functions from Crypto++ library? I tried used these codes for SHA1 and MD5. I have many errors on line where is StringSink . The errors are like: undefined reference to `CryptoPP::StringSinkTemplate::StringSinkTemplate(std::string&)' Thanks for help. // SHA CryptoPP::SHA1 sha1; std::string source = "Hello"; std::string hash = ""; CryptoPP::StringSource(source, true, new CryptoPP::HashFilter(sha1, new CryptoPP::HexEncoder(new CryptoPP::StringSink(hash)))); std::cout << hash; // MD5 CryptoPP::MD5 hash; byte digest[ CryptoPP::MD5::DIGESTSIZE ]; std: