Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-1 votes
0 answers
43 views

How do I convert HOTP counter value to unsigned char*?

I am now facing issues implementing HOTP using HMAC-SHA1. I am not sure how do I convert the "Counter" from int to unsigned char* for HMAC hashing. I call hmac_6_digit_totp() as below ...
jnl's user avatar
  • 9
1 vote
0 answers
75 views

HMAC-SHA256 hash using OpenSSL does not match hash from online tools

I am trying to use OpenSSL 3.4.0 to generate an HMAC hash EVP_sha256. However, I am not able to match my generated hash to online tools (tried: base32 encoded key for each side). Here is my source ...
jnl's user avatar
  • 9
1 vote
0 answers
103 views

signature verification issue with crypt32.dll CryptMsgControl api

We have an application which transfer EDI documents using AS2 protocol where When we send data to one of our business partner and try to verify the signature of the MDN that business partner return to ...
DKM's user avatar
  • 155
0 votes
1 answer
74 views

Verifying signed message with Qt's QCA::SecureMessage

I want to write a Qt application that reads a signed message and verifies its signature through QCA::SecureMessage. Using QCA's examples page and reading their unit tests from the publicly available ...
Michele Bolognini's user avatar
5 votes
1 answer
137 views

How to decrypt C++ OpenSSL ChaCha20 from nodeJS?

I'm trying to decrypt data that have been encrypted using C++ OpenSSL ChaCha20 from Node.js, but standard Node.js crypto module doesn't directly support ChaCha20 without Poly1305. I have tried using ...
Renan's user avatar
  • 79
2 votes
0 answers
69 views

Loading OpenSSH public private keys into CryptoPP

I want to load openssh public key and private key using CryptoPP lib, the code is as follows: #include <cryptopp/files.h> #include <cryptopp/rsa.h> #include <exception> int main(int ...
Richard's user avatar
  • 31
1 vote
1 answer
71 views

Aes-256-GCM OpenSSL > nodeJS

I'm trying to decrypt data that have been encrypted using C++/OpenSSL Aes-256-GCM from nodejs javascript. C++ encryption implementation: #include <string> #include <sstream> #include <...
Lillo's user avatar
  • 32
0 votes
2 answers
145 views

Converting double type to binary in C++

I have a task to test various pseudo random number generators in C++, using NIST-800-22. NIST test suite requires me to convert generated numbers and store them in binary format, for integers it wasnt ...
royalewski's user avatar
1 vote
0 answers
100 views

Understand OpenSSL's AES-256-CBC encrypt/decrypt - IV issue

There's openssl code that I try to understand why it is working. See this code below. It has encryption and decryption functions over OpenSSL's AES-256-CBC cipher. It also contains simple main() ...
Miko Nahum's user avatar
0 votes
0 answers
49 views

Issue with Mismatched Tweaked Public Keys in Ed25519 Using Libsodium in C++

I'm working on a cryptographic project using the Ed25519 curve and Libsodium in C++. My goal is to tweak an initial key pair by adding a derived scalar to the initial seed and then generate the ...
cryptos's user avatar
3 votes
0 answers
55 views

Make OpenSSL use pointers from input buffer for holding cms structure instead of allocating memory

An embedded device with limited memory is already using OpenSSL for communication. I am implementing a CMS signature verification wrapper library using OpenSSL that should work for the device. We ...
murali's user avatar
  • 33
0 votes
1 answer
275 views

Import Private Key to Microsoft TPM Virtual Smart Card without popups for card selection and PIN

I am trying to import private key to Microsoft TPM Virtual Smart Card. With legacy crypto API, private key is imported successfully. verified with certutil -scinfo. Problem with this approach is, it ...
HNR's user avatar
  • 91
1 vote
1 answer
721 views

Getting "Signature for this request is not valid." in Binance websocket api while using ed25519 keys in C++

Hi I'm trying to send orders to Binance websocket api wss://ws-api.binance.com:443/ws-api/v3. I'm using ed25519 keys to sign my order json data. When i'm sending the request i'm getting: {"id&...
Soumalya Sahoo's user avatar
-1 votes
1 answer
71 views

Encountered this error while implementing NTT cpp code: terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

I recently started implementing post-quantum crypto and needed to implement the polynomial multiplication for which number theoretic transform (ntt) is used to reduce its time of computation and this ...
Dakshi R's user avatar
0 votes
0 answers
154 views

Add Botan library to CLion C++ project

I have been trying to add the Botan library to my C++ project but I haven't figured it out yet. I am on Ubuntu 22.04 using CLion with CMake. I downloaded the latest (3.3.0) release from GitHub and ...
Coderless's user avatar
1 vote
0 answers
245 views

Lua 5.1 bitwise operations using arithmetic for 64bit numbers

Lua 5.1 does not yet support bitwise operators. The Lua environment I'm using is restricted and provides a bit32 library that allows bitwise operations with 32-bit numbers. The issue is that I'm ...
neth's user avatar
  • 19
0 votes
1 answer
173 views

Can not read private key from a string rather than a file in crypto++

I need to use an openssl generated key to sign messages via cryptopp lib. The key generated with: openssl genrsa -out privatKey.pem 2048 and to get rid of the error CryptoPP::BERDecodeErr when loading ...
ibse's user avatar
  • 583
0 votes
0 answers
71 views

Crypto++ text file Decryption not working properly

I am trying to decrypt an encrypted file Using the Crypto++ Library. The encryption seems to work perfectly as the file that I am encrypting has Cipher text when I open it. However , just in case I ...
Luca Alfino's user avatar
0 votes
1 answer
103 views

How do I replicate PHP's hash_hmac function in C++?

I'm trying to replicate PHP's hash_hmac function in C++ using wincrypt. Someone sent me this MS link titled "Example C Program: Creating an HMAC". I copy all of the code and the result ...
Andrew's user avatar
  • 1,653
-2 votes
1 answer
94 views

Demonstrating that double Affine encryption offers no additional security compared to single encryption

I'm currently taking an online Cryptography course, and one of the assignments is to demonstrate that encrypting data multiple times with the Affine cipher does not actually enhance its security. I've ...
Michele's user avatar
  • 11
0 votes
0 answers
342 views

Error during decryption using Openssl EVP_DecryptFinal_ex

I have simple implementation of AES GCM, with encryption and decryption functions. During testing I obtained an error during decryption. In particular, after the encryption that seems correct, I have ...
Salvatore Lombardi's user avatar
0 votes
0 answers
226 views

How to decrypt with password/salt an encrypted string with c++ openssl on nodejs

Im trying to decrypt an encrypted string with password/salt using c++/openssl. In my attempt below the generated key on js matches the key generated from the c++ function, but the iv's doesnt. Its ...
Jabu's user avatar
  • 134
0 votes
0 answers
132 views

How to decrypt using a passphrase and salt using the crypto++ lib?

I'm trying to decrypt a string that has been encrypted using openssl, evp_aes_128_cbc, and a password/salt I have succeeded decrypting it using openssl, but not using the crypto++ lib. The key ...
Jabu's user avatar
  • 134
1 vote
0 answers
233 views

How to calculate file hash with crypto++

I'm trying to convert this qt hash function to "c++ only" and using the crypto++ lib QString calculateGitHubFileHash(const QString& filePath) { QFile file(filePath); QString ...
Jabu's user avatar
  • 134
0 votes
0 answers
152 views

invalid PKCS #7 block padding found in file decryption

I am working on a project that includes encrypting and decrypting files, I process the file and then I encrypt it and save it on a new file with a custom file extension, the file includes the ...
Simon's user avatar
  • 1
0 votes
1 answer
82 views

Getting Error While Decryption An AES Encrypted String In Cpp

When I decrypt a string with the decryption function I got some redundant characters. Actually, this code is written for encrypting and decrypting raw bytes. Here is my code. Python AES Encryption ...
RockStar Techs's user avatar
-1 votes
1 answer
53 views

How to get matching Z from Tpm2.EcdhZGen() and NCrypt.DeriveKeyMaterialHash()

I have a project where one application ("Alice") sends AES encrypted messages to another ("Bob"). Both parties have the public key of the other party - let's assume no ephemeral ...
Hamish's user avatar
  • 311
1 vote
0 answers
138 views

Signature in my generated csr is invalid. What can be the probable reason?

I am using safenet sdk's library to generate public key and private key in Dongle. Then, I am sending public key as bits to my swift application. I am also signing my certification info with private ...
ahad alam's user avatar
0 votes
1 answer
129 views

How to implement OpenCL to a program which uses GMP Library? The Kernel Code is not recognizing mpz_class and mpz_invert

I am trying to implement OpenCL for a C++ project which uses GMP Library (using Ubuntu). But the Kernel code is not recognizing mpz_class, its variables or any of the GMP functions. It is also not ...
Nikhil Srinivas's user avatar
0 votes
1 answer
277 views

Bcryptdecrypt unable to decrypt data correctly

I have some data that was previously encrtypted with cryptdecrypt APIs. Since it is deprecated I am supposed to move to the latest bcryptdecrypt (CNG)APIs. But with this code I am not able to decrypt ...
RituV's user avatar
  • 63
-1 votes
2 answers
303 views

How to get 11 bits representation from 8 bit (uint8_t) array in C++

I am trying to implement **BIP39 **standard in my project. Everything else if fine but I am badly stuck and I have searched Google and ChatGPT to the greatest depths, but no solution found. I have ...
Jamma Daud's user avatar
1 vote
2 answers
316 views

How to generate extremely large random numbers? [closed]

What is the best way to generate large random numbers (bigger than 10e32)? I have seen a lot of things for better generations (mt19937 instead of rand()) but they are still relatively limited in size. ...
Dedbot's user avatar
  • 13
-8 votes
4 answers
903 views

Fastest way to bring a range [from, to] of 64-bit integers into pseudo-random order, with same results across all platforms?

Given some interval [a, b] of indices (64-bit unsigned integers), I would like to quickly obtain an array that contains all of these indices ordered according to a uniformly distributed hash function, ...
xamid's user avatar
  • 486
1 vote
2 answers
326 views

Can't load generated public key from NodeJS into Windows via CNG APIs

I generate RSA public/private key pairs in NodeJS using crypto library: crypto.generateKeyPair( "rsa", { modulusLength: 1024, publicKeyEncoding: { type: &...
Mustafa Chelik's user avatar
-2 votes
1 answer
68 views

The C++ program incorrectly outputs the message

My program encrypts and decrypts the message according to Shamir's algorithm, one finally decrypted message does not converge with the input, they say that this problem may be related to encoding, ...
n1rut's user avatar
  • 3
0 votes
1 answer
696 views

Updating from Windows CryptDecrypt() to NCryptDecrypt() returns NTE_INVALID_PARAMETER(0x80090027) or STATUS_UNSUCCESSFUL(0xC0000001)?

Currently updating from Windows CryptDecrypt() [API is deprecated] to NCryptDecrypt() [Cryptography Next Generation]. The minimal sample code below tries to encrypt/decrypt using RSA 1024-bit. Running ...
vengy's user avatar
  • 2,205
6 votes
1 answer
1k views

Regarding the use of secp256r1 and x25519?

I'm implementing some protocol using some 3rd party repository (Private Join and Compute), and the repo only supports built-in curves in FIPS modules (P-224, 256, 348 and 512) in openssl when creating ...
DDD's user avatar
  • 63
1 vote
1 answer
74 views

How can I convert a number (of type std::string) to its binary representation in std::vector<bool> in C++ without external libraries?

I'm trying to convert a string (like "12345") to its binary representation held in a boolean vector (so it would be {1,1,0,0,0,0,0,0,1,1,1,0,0,1} but the current attempt only works for ...
Liam Goss's user avatar
1 vote
2 answers
138 views

Is there a significant difference between using a in built random number generator vs using cryptographic random number generator?

I was going through the Crypto++ library RNG page and I was wondering is there any issues with using something like std::srand(std::time(nullptr)); //using the current time as seed compared to the ...
Riperoni's user avatar
1 vote
1 answer
160 views

OpenWall BCrypt: Example of Hashing Input using crypt_r and explanation of inputs and best practice

I am struggling with finding examples for OpenWall's bcrypt implementation that use crypt_gensalt_rn and crypt_r that also explain in depth exactly what is happening in terms of input, settings etc ...
Warren Niles's user avatar
0 votes
1 answer
298 views

RSA-CBC decrypt it using C++

I'm stuck with the problem of decrypting AES-CBC ecrypted string. I have JS code which decrypt that string but I need do that in C++. Key is string of SHA512 hash, and message is string of Base64. The ...
DreamCoder's user avatar
0 votes
0 answers
120 views

How to use hard-coded keys for two parties to form key agreement using ECDH from cryptopp library as demonstration?

I need your help through This code that is an example of how to use the Crypto++ library to perform a Diffie-Hellman key exchange. The code uses the secp256r1 curve to generate the public and private ...
janhere3's user avatar
0 votes
1 answer
521 views

OpenSSl 3 not verifying (using) tag using chacha20 poly1305

i just started learning openssl, when i use chacha20_poly1305() to encrypt and mac some text, it does not work What am i doing wrong, how does this work int main( ) { unsigned char key[] = "...
xzijoq's user avatar
  • 1
0 votes
1 answer
399 views

'message hash or MAC not valid' AES GCM when decrypting

I am trying to convert a snippet of Python code to C++. The Python code reads ciphertext and a key from a file and uses PyCryptoDome to decrypt. I have tried to replicate this behavior in C++, however,...
rsa16's user avatar
  • 13
1 vote
1 answer
362 views

How to verify RSA signature generated by Python-RSA using Crypto++

I have a server written in Python, and a C++ client. The Python server has a private RSA key, and the redistributable C++ client has the paired public key. The C++ client sends a string to the Python ...
user325962's user avatar
0 votes
0 answers
54 views

What is causing this unexpected output?

I am writing a disk encryption utility with the cryptopp library in c++ but the program fails to work when i pass the salt and password from the commandline. It works perfectly fine when the values ...
jamie_0101's user avatar
-1 votes
1 answer
268 views

Crypto++ | HexEncoder sometimes encodes incorrectly | HexEncoder not working consistently | Undefined behaviour?

I have written a simple encrypt & decrypt function and everything works. Except sometimes the HexEncoder seems to encode the cipher far too way small. Therefore the decryption fails. But this ...
user283487's user avatar
0 votes
2 answers
633 views

How to decrypt a file in memory?

I'm encrypting a file this way: #include <cryptopp/files.h> #include <cryptopp/modes.h> #include <cryptopp/osrng.h> #include <cryptopp/base64.h> #include <cryptopp/hex.h> ...
Cesar's user avatar
  • 379
0 votes
1 answer
500 views

Poco C++: Poco::Crypto::RSAKey class is deprecated. How to encrypt plain text with private key?

For a my personal C++ project, I'd like been able to encrypt plain text data using private key. In my project I make an extensive usage of Poco C++ library, and I'd like handle such feature with it. ...
Claudio Cavallero's user avatar
7 votes
1 answer
6k views

How to encrypt a string using OpenSSL C library and a public key file?

What is the recommended way of encrypting a short std::string into another std::string using the openssl C library (not the command-line tool of the same name) using a public keyfile, and knowing the ...
goose_lake's user avatar
  • 1,366

1
2 3 4 5
14