Newest 'crypto++' Questions

Q&A for professional and enthusiast programmers

Encryption with Crypto++/AES CFB not working

I have a simple console program that should encrypt files with AES CFB algorithm from Crypto++ library. For some reason it is not working. Encoding part: byte data[16] = { 0x88, 0x44, 0x88, 0x44, ...

How to encrypt and decrypt with RC6 using Crypto++

I want to encrypt and decrypt strings with RC6 but I don't understand how it works with the Crypto++ library, could you give me a snippet ? Thanks you !

Encrypt big char* using std::string with Crypto++

I am new with Crypto++. I want to using Crypto++ library to encrypt/decrypt a large byte array in C++. The data can be anything, so asume its binary format. First, I tried with "byte array" (char * or ...

Generate RSA signature in Java but verify the signature failed in C++

Recently I need to use RSA to sign a string in Java, and verify the signature in C++. In Java, now I think every thing is OK,I create public.keystore and private.keysore and can sign&&veify ...

Crypto++ DefaultEncryptor/DefaultDecryptor scheme

I am trying to encrypt a file using AES with crypto++. I can see the functions EncryptFile and DecryptFile which use DefaultEncryptorWithMAC/DefaultDecryptorWithMAC from test.cpp in crypto++. void ...

Convert CryptoPP::Integer to LPCTSTR [duplicate]

I can't find the right code to convert a CryptoPP::Integer (from a RSA key generation) to a LPCTSTR (I want to store the key in the registry). Could you help me ? Thanks you !

Crypto++ Lib in C#

I am using the Crypto++ library for using various encryption algorithms. I know the library is written using c++ as the language, but I want to use the SAME library in C#. How can I convert this ...

Crypto++ CTR mode manual implement

I am trying to make CTR manually on top of ECB mode (but still) using Crypto++. The idea is: For single block: Just use ECB For multiple block, use CTR algorithm (AFAIK): //We have n block of ...

warning: libcryptopp.so: is missing DT_SONAME will use basename as a replacement

I am trying to build libcryptopp.so and include it in my JNI code, follow the guide in Android Crypto++, I experienced the following problems. Missing symbol problems in Crypto++ 5.6.3 Originally I ...

How to cast a char* to a byte* in c++?

I am very new in c++ and want to cast a char* from a std::string to a byte*. Here is my code: inline string XOR(const string &value, const string &key) { string retval(value); CryptoPP::...

Array parameter getting decayed

I am trying to pass 2 byte arrays to a file encryption function I wrote. However, when I do both arrays are truncated to size 8 (from size 16) thus causing the function to not work properly. I am not ...

AES Encryption with Crypto++ not working

I have a simple console program that should encrypt files with AES CFB algorithm from Crypto++ library. For some reason it is not working. Encoding part: byte data[16] = { 0x88, 0x44, 0x88, 0x44, ...

Converting Node.js HMAC to C++

Ive been working on a project, and as part of it I need to convert the Node.js code var hash = crypto.createHmac('sha512', key).update(text).digest('hex'); to C++. I've decided to use Crypto++, ...

Cannot pass AutoSeededRandomPool as parameter when using CryptoPP::RSA, error C2729

I am working with implement RSA using Crypto++. I am trying to generate a pair of RSA keys (public and private) to file like this. The code can run perfect when I put all in main. When I try to split ...

Gargage redundancy character at the end of original text when decrypt using Crypto++

I am using Crypto++, CTR mode, to encrypt and decrypt text in C++. Everything seem to worked 99%. Ecrypting success, decrypting is give back the original text too, but I given some extra random ...

C++ JWT Crypto++ Empty Signature

I want to generate a JWT (jwt.io) token using Crypto++ but I am getting a empty signature. I am on a OSX 10.12, XCode 8.1. I have generated a 2048 bit RSA key pair with "ssh-keygen -t rsa -b 2048 -f ...

Convert byte* {aka unsigned char*}’ to ‘byte [32] {aka unsigned char [32]}

I am using Crypto++ Salsa20 as a part of my project. The above link has an example code in which they define byte key[32]; So I have a string of 64 bytes. I got this value from SHA256. Basically ...

How to initialize AES-256 key with user defined password

What if I want to encrypt data, using the Crypto++ library and having a user defined password that is shorter then 32 Byte? Right now I have the following code: byte passwordBytes[AES::MAX_KEYLENGTH]...

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

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 ...

How to convert base64 to Integer in Crypto++?

I use Crypto++ library. I have a base64 string saved as CString. I want to convert my string to Integer. actually this base64 built from an Integer and now i want to convert to Integer again.but two ...

Crypto++ Init-Update-Final get cipher output

In a effort to encrypt large file using Crypto++, I am following ecrypting using Java-like Init-Update-Final in Crypto++, The demo code seem to work, everytime the Put is invoked, the output byte is ...

Using (Crypto++) Blowfish implementation to implement Bcrypt

I am implementing a password storing system and currently seeking to have Bcrypt hashing support. As I already use Crypto++ for other stuff and it has a solid implementation of Blowfish, and from what ...

type cast CryptoPP::Integer to int

I don't have any experience of Crypto++ library. In my project I need to typecast Integer to int. This is what I am trying: int low_bound1=8; int low_bound2=9; Integer x=1,y=2; low_bound1=(int)x; ...

How to change sink in Crypto++

I'm using Crypto++ to decrypt a file, so I use FileSource as my source but I want to be able to change sink, so I can achieve something like following: std::string temp; FileSource file("/path/to/...

File Encryption with AES in Java decrtypion in C++ using cryptopp

I'm experimenting with Crypto++ library and javax.crypto library. So what I'm trying to do is... encrypting a text file using AES with CFB mode in java, and then decrypt the encrypted file using ...

Trouble Verifying Message RSA Signature Scheme Over Sockets

Im trying to send signed messaged from my server over a socket to a client. I am having trouble verifying the messages. I have tried the filtered and non filtered way based off of the code examples ...

Convert encoded std::string from Base16 to Base10? [closed]

I have a std::string with a large integer encoded in Base16: bbb91c1c95b656f386b19ab284b9c0f66598e7761cd71569734bb72b6a7153b77613a6cef8e63 ...

How to save encrypted FileSource data to byte array?

This is the code of Crypto++ FileSource to encrypt a large file. Its works perfectly but all in blackbox and doesn't allow me to save encrypted data to a byte array when encrypting. I want to know the ...

ECIES with AES and CBC in Crypto++

I need to implement in Crypto++ the equivalent to BouncyCastle's "ECIESwithAES-CBC/NONE/PKCS7Padding". The main reason is that I need to encrypt data on iOS and decrypt it on the backend with ...

Missing symbols Rijndael::Enc::ProcessAndXorBlock and Rijndael::Dec::ProcessAndXorBlock

I am trying to compile a code for AES however I get an error when i try to do it. The code is given below: #include <iostream> #include <iomanip> #include "modes.h" #include "aes.h" #...

How can I do XOR operation in Crypto++?

I want to perform XOR operation in AES before and after encryption in AES (like DESX) with new keys. But XOR operation takes too much time. How can I reduce the XOR operation time? Here is my code: ...

Why It is givin segmentation fault when I run Crypto++ benchmark tests? [closed]

I have to make some tests. I add my new algorithm (an aes version) to crypto++. But when I run Crypto++ benchmark It is givin segmentation fault. Any idea why? Thanks for help.

Is a “block padding” exception expected when using the wrong key during decryption?

I am currently working on a password manager for my own and the encryption process of the database is working perfectly fine comparing the result I get with test vector. To decrypt the ciphertext, I ...

Why AES code in Crypto++ gives different performance results?

I am trying to test performance of AES encryption. But whenever I am running the code it is giving different results.Why? Here's the code in C++ using Crypto++: int main(int argc, char* argv[]){ ...

Memory leak in Crypto++ RSAES class

I'm trying to learn how to use Crypto++ classes. My goal is to generate public and private keys for RSA encryption and then do basic encryption and decryption of a plaintext. So I'm taking their ...

Manual CBC encryption handing with Crypto++

I am trying to play around with a manual encryption in CBC mode but still use Crypto++, just to know can I do it manually. The CBC algorithm is (AFAIK): Presume we have n block K[1]....k[n] 0. cipher ...

Crypto++ explicit destruction during encryption/decryption?

I wrote some wrapper functions to encrypt/decrypt files using crypto++. I tried looking in the wiki but could find my answer. I am wondering if I need to explicitly destroy my objects that are created?...

Encrypt with Crypto++ and Decrypt with Python.CRYPTO

I'm working on a project that uses Crypto++ to encrypt some data using RSA. Here is my Crypto++ code: string plain = "Text123", encoded, cipher; string pkey = "..."; StringSource ss1(pkey, true); ...

Encrypt and Decrypt a message using raw RSA algorithim in Crypto++?

I am using Crypto++ library for cryptography related works. And sub-part of task is to encrypt and decrypt a text. The message can be up to 256 character long containing alphanumeric number spaces dot ...

Is it possible to add a new algorithm to cryptopp benchmarks?

I want to bench an algorithm (aes version) which is not in cryptopp benchmarks. If it is possible, how can I do this? Any help would be appreciated.

Decrypting Crypto++ RSA cipher text in C# causes exception

I've written 3 functions in C++ using Crypto++ to generate key pairs, encrypt and decrypt a string. Crypto++ side: //Decode public key RSA::PublicKey pbKeyDecoded; StringSource ss2(publicKey, true, ...

Encrypt/Decrypt byte array Crypto++

I am trying to encrypt a byte array using AES. I have been able to encrypt strings and files no problem, however byte arrays seem to not be working for me. I pass in a byte array to be encrypted, for ...

GCC and Crypto++ on makefile

I'm trying to compile C++ project with gcc-make command but program giving this error. I already compiled Crypto++ and added include and lib folder but I dont know how to add this dir to gcc. What ...

How to load Base64 RSA keys in Crypto++

I'm trying to write helper functions for a program I'm making and I need to return the keys as strings. Found a way to convert the RSA keys from PrivateKey/PublicKey to Base64 string. int main() { ...

“Mutex” Error when using Cryptopp with Windows Forms

I'm using Visual Studio 2015 An CLR application and I added a UI windows form I want include some Crypto++ functions into my Form header file so I add these lines after #pragma once #include <...

Calculating CRC of file as numeric value using Crypto++

I am receiving file along with its CRC which is numeric value. I must recalculate CRC on received file and compare it. I am using Crypto++ but it didn't give me numeric value. Please let me know how ...

StreamTransformationFilter: ciphertext length is not a multiple of block size?

I am trying to encrypt and decrypt a plain text using aes algorithm present in crypto++ Here is my encryption method /* * Encrypt the given text */ template<typename T> T encryptText(T ...

InvertableRSAFunction Fails on encrypting Diffie-Hellman Keys as const byte*

Before we begin here, I have a server and a client. I wish to send an encrypted string to the client that contains the server's Diffie-Hellman public static key and public ephemeral key. To do so, I ...

Why AES-128 performance is not %40 better than AES-256

I am making performance tests over AES-128 and AES-256. But my results are around %20. I am using Intel Core 2 Duo 800 MHz. 2.60 GHz. 6 MB Cache Memory T9500 CPU and Linux Mint 17.2 Rosa Xfce Os. Is ...

Effecient way for encrypt large data using Crypto++

I am looking for a solution to encrypt/decrypt a very large file (some GBs) using Crypto++. Several days ago, I was thinking about using StringSource in this question, read whole file into a char ...
Translating... 0%