crypto++

Skip'ing on a Source does not work as expected

我是研究僧i 提交于 2019-12-11 05:31:13
问题 I use Crypto++ 5.6.3 and iI need the FileSource Skip(...) function. Unfortunately this function does nothing! Here is a example for this function. string filename = ...; string str; FileSource file(filename, false, new HexEncoder(new StringSink(str))); file.Skip(24); file.PumpAll(); Can somebody help me? 回答1: I use Crypto++ 5.6.3 and iI need the FileSource "skip(...) function. Unfortunately this function does nothing! I was able to duplicate this using strings under Master, 5.6.3, and 5.6.2

Saving key and iv to file AES implementation Crypto++

ぃ、小莉子 提交于 2019-12-11 05:15:01
问题 So I am using the Crypto++ Library to encrypt a file. I need to save the key and iv for future use. I am following this tutorial. Here is my function : void AESUtil::encrypt(string filename,bool savekeys,string savefilename){ AutoSeededRandomPool rnd; // Generate a random key byte key[AES::DEFAULT_KEYLENGTH]; rnd.GenerateBlock(key, AES::DEFAULT_KEYLENGTH); // Generate a random IV byte iv[AES::BLOCKSIZE]; rnd.GenerateBlock(iv, AES::BLOCKSIZE); Binary b; string plaintext = b.decoder(filename);

Getting exception “RSA/OAEP-MGF1(SHA-1): ciphertext length of 154 doesn't match the required length of 192 for this key” during decrypting session key

心不动则不痛 提交于 2019-12-11 05:04:57
问题 I am getting "RSA/OAEP-MGF1(SHA-1): ciphertext length of 154 doesn't match the required length of 192 for this key" when I try to decrypt encrypted session key which uses crypto++ library. Following are code snippets for the same: std::string encrypt_session_key(PAES_KEY_WITH_IV pKey) { std::string ciphered; CryptoPP::SecByteBlock block(pKey->key.size()); try { CryptoPP::RSAES< CryptoPP::OAEP<CryptoPP::SHA> >::Encryptor enc(RSA_master_pubKey); enc.Encrypt(rng, pKey->key, pKey->key.size(),

How to sync Crypto++ RSA with C# RSA crypto service provider?

大兔子大兔子 提交于 2019-12-11 04:58:03
问题 I crypt a string text with use of Crypto++, but when want to decrypt it by C# RSA crypto service provider I have an exception. My code produces same cipher string when encrypt a same string with constant public key by Crypto++ in several time, while there are different results (cipher string) with use of C# RSA crypto service provider. Is main reason of this problem (run-time error) related to different type of RSA? My encryption code using Crypto++ is in below: string message((char*)"hi", 2)

Linker errors when building DLL dependent on static lib Crypto++

旧城冷巷雨未停 提交于 2019-12-11 04:34:23
问题 Here is a preface - I have a C++ + Qt application, it consists of several projects and we are using MSVC 2012 to build it. Now, I'm implementing build scripts to start deploying build server. So, I started creating Qt .pro files for each and every project we have. Now the problem - we use Crypto++ library(http://www.cryptopp.com/) which we build from source code and the output is static lib, and we have DLL which depends on cryptlib.lib. I wrote .pro file for Cryptlib and I'm able to build it

Linking error when compiling Crypto++ for ARMHF

无人久伴 提交于 2019-12-11 03:06:43
问题 I'm trying to compile the crypto++ library to run for the armhf architecture. I'm following the method provided in this answer. I tweaked the setenv-embed.sh to match my system's configuration. The output of running . ./setenv-embed.sh is CPP: /usr/bin/arm-linux-gnueabihf-cpp CXX: /usr/bin/arm-linux-gnueabihf-g++ AR: /usr/bin/arm-linux-gnueabihf-ar LD: /usr/bin/arm-linux-gnueabihf-ld RANLIB: /usr/bin/arm-linux-gnueabihf-gcc-ranlib-4.8 ARM_EMBEDDED_TOOLCHAIN: /usr/bin ARM_EMBEDDED_CXX_HEADERS:

Compiling Crypto++ for armhf for cross compiling

瘦欲@ 提交于 2019-12-11 03:01:41
问题 I want to cross compile the library crypto++ for deployment on a beaglebone running Debian. My host PC runs Ubuntu 14.04 LTS in a 64-bit configuration. I face the following problem when I invoke the make command from eclipse arm-linux-gnueabihf-g++-4.8 -L/usr/include/cryptopp -o "GCMwithAES" ./main.o -lcryptopp /usr/lib/../lib/libcryptopp.so: file not recognized: File format not recognized My guess is that since the compiler is configured for armhf, it cannot recognize the library that was

Unable to do RSA Encryption/Decryption using Crypto++ (isValidCoding is false)

依然范特西╮ 提交于 2019-12-11 02:56:27
问题 I am using Crypto++ to encrypt an array of bytes using RSA. I have followed Crypto++ wiki's samples with no luck getting them to work. Encryption and Decryption in all the samples are done within a single process but I am trying to decrypt the content which is already encrypted in another process. Here is my code: class FixedRNG : public CryptoPP::RandomNumberGenerator { public: FixedRNG(CryptoPP::BufferedTransformation &source) : m_source(source) {} void GenerateBlock(byte *output, size_t

InvalidCiphertext exception when decrypting ciphertext

别来无恙 提交于 2019-12-11 02:24:29
问题 I'm working in a new protocol for secure communication and I'm having problems to decrypt the ciphertext. The data packet is saved in a uint8_t* variable and encrypted. Until this part is all going well. But when I try to decrypt I got the followings problems: 1) If I send the vector and the size (it's really 20 but I just want to decrypt the last 16 bytes): CBC_Mode< AES >::Decryption decryptor; decryptor.SetKeyWithIV( key, CryptoPP::AES::DEFAULT_KEYLENGTH, iv ); CryptoPP::StringSource ss(

Steps to decrypt encrypted data in Crypto++ in libgcrypt

六月ゝ 毕业季﹏ 提交于 2019-12-11 01:59:30
问题 I need to decrypt the encrypted data by Crypto++ in libgcrypt due to C language restriction on target platform. So I've decided to use libgcrypt since it supporting the AES128 and GCM mode. In Crypto++, the data is encrypted this way: std::string encrypt_data(const std::string &data, const std::vector<unsigned char> &iv, const std::vector<unsigned char> &key) { CryptoPP::GCM<CryptoPP::AES>::Encryption encryptor; encryptor.SetKeyWithIV(&key[0], key.size(), &iv[0]); std::string ciphertext;