Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
75 views

RSA signature verification failing for smartcards

I am trying to sign a byte string using the c_sign function from pkcs and I am trying to verify it using RSA.verify() function in ASP.net, but for some reason its failing. I am using 2048 bit RSA keys ...
Ajith Nair's user avatar
1 vote
0 answers
48 views

Difference between the BN_mod_mul_reciprocal and BN_mod_mul_montgomery function groups in OpenSSL

The OpenSSL C library has two different sets of functions for performing modular multiplication quickly: BN_mod_mul_reciprocal and BN_mod_mul_montgomery. What are the differences between using either ...
Hippopotoman's user avatar
0 votes
0 answers
84 views

How to import an ECDSA to the kernel crypto API: crypto_akcipher_set_pub_key always returns error?

I'm working on a kernel module which uses asymmetric cipher of kernel crypto api, kernel version 6.5.0. I generate asymmetric key pairs by openssl, convert them into DER format and import it into the ...
Wenhao Wang's user avatar
1 vote
0 answers
56 views

How can i implement a triple aes encryption to make dpa attack last a little longer on my case study? [closed]

I am trying to implement tmr methodology for my AES operation and i want to do it with the same key and the same plaintext slightly changed randomly for the last two plaintexts. I also added a voter ...
vedizo's user avatar
  • 11
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
0 answers
110 views

i am getting "undefined reference" error while i am going to defination it is there in arduino ide

I'm trying to generate keys for encoding and decoding using the Kyber API in an Arduino project, but I'm encountering a compilation error. My code includes the api.h header and attempts to call ...
Tejas Rane's user avatar
0 votes
1 answer
154 views

Replicating hkdf2 key derivation in C

I am trying to create a derived key from my shared secret and shared key. I have done this before, in Java and Python, where it is a fairly straight forward process, however, it seems that in C this ...
Tom Rowbotham's user avatar
2 votes
1 answer
182 views

Aligning Key Sizes Between OpenSSL and liboqs-go for Signature Verification in Go

I am developing a cryptographic application in Go, aiming to utilize keys generated by both OpenSSL and liboqs-go for signing and verifying purposes. I'm using the Dilithium2 algorithm through both ...
O21's user avatar
  • 31
0 votes
1 answer
422 views

How to Generate Dilithium Keys with `liboqs-go` and Convert Them to PEM Format for OpenSSL

I am trying to using the liboqs-go library to generate cryptographic keys with post-quantum algorithms and need to use these keys with OpenSSL to generate CSRs and certificates. However, I'm facing ...
T_21's user avatar
  • 11
1 vote
0 answers
92 views

MbedTls: Does mbedtls_gcm_auth_decrypt output have the same length as input after decryption? Why/Does it need an extra 8 trailing bytes during?

MBedTls AES-GCM-In-Place-Decryption: Does mbedtls_gcm_auth_decrypt output-buffer have the same length as the input-buffer after encryption? Why does it/Does it really need an extra 8 trailing bytes ...
dfmg's user avatar
  • 41
0 votes
0 answers
130 views

VS Code -- openssl/aes.h: No such file or directory gcc [Ln 4, Col 10]

I am trying to implement a time attack. Briefly there are these steps a) Timing Measurement ( <time.h> to measure time ) b) Cryptographic Operations (For AES encryption, i am using OpenSSL) c) ...
Muhammad Faheem Sajjad's user avatar
2 votes
1 answer
196 views

SHA256 Endianness problems

For a project, I wanted to implement SHA256 in C from scratch. However, the specification here mixes things up with little and big endianness and makes things unclear. I've coded the entire hashing ...
ampersander's user avatar
2 votes
1 answer
173 views

Mbed TLS: in-place en-/decryption for OAEP doesn't seem to work

RSA encryption/decryption works in Mbed TLS when using separate buffers where plainText, cipherText, and decryptedText (i.e. the content of plainText and decryptedText) are the same. However, it does ...
dfmg's user avatar
  • 41
0 votes
1 answer
307 views

RSA between C# and C's BCrypt [duplicate]

I am trying to use RSA 2048 to have encryption between my C# and C programs. To accomplish this, I am imbedding the private key inside my C program and imbedding the public key inside the C# program. ...
UnSure's user avatar
  • 150
1 vote
0 answers
187 views

Converting C# RSA private key into a form BCrypt can understand

I need help using BCrypt to communicate between my C# app and my C app. Specifically, I need to imbed the private key inside my C application and then imbed the public key inside my C# app since my C# ...
UnSure's user avatar
  • 150
2 votes
0 answers
116 views

RSASSA-PSS signature verification fails dues to padding with mbedtls but succeeds in Python

I am trying to verify signatures like this using mbedtls in C-Ansi but it fails even though that the same signature is verified in Python. The code is being ran in the i.MX RT1170 CM7 using the crypto ...
Dan's user avatar
  • 29
2 votes
0 answers
266 views

Deterministic CTR_DRBG in OpenSSL

I'm using the OpenSSL EVP API in C to call the CTR_DRBG implementation and I'm having some trouble getting the output to be deterministic. Configuration and all input arguments are fixed (entropy, ...
Francisco Abelardo Garcia Avil's user avatar
0 votes
0 answers
193 views

MbedTls: Writing public-key in DER-format (mbedtls_pk_write_pubkey_der) works, but writing same key in PEM (mbedtls_pk_write_pubkey_pem) fails?

I'm trying to write out a public key created using MbedTls in a c-programm. This works when using the function to write out DER-keys as it returns the number of bytes written (91) and the key in ...
dfmg's user avatar
  • 41
1 vote
1 answer
119 views

What's wrong with the following implementation of MD5?

I'm trying to implement a MD5 hash function in C. I've read the RFC, and done the following, and am trying to figure out what's wrong in here. I know that I should probably be using a library like ...
Yaksh Bariya's user avatar
1 vote
1 answer
84 views

Cryptography in C

You have intercepted a poorly evolved terrorist cell that uses Caesar's method as a cipher. Messages are always in English. What they do is replace each letter with another letter by moving the ...
Birdy's user avatar
  • 33
0 votes
0 answers
24 views

XOR Hex and ASCII [duplicate]

I have a 16 bit key (e.g., abcd) that represents hex values, and a 16 bit input (e.g., 0123) that I read in and stored in a character array. How would I XOR these together in C? I'm pretty stuck on ...
Mell's user avatar
  • 33
1 vote
1 answer
199 views

Internal handling of IV in AES_GCM_256, for multiple encryption calls on same plaintext

I am trying to understand the working of OpenSSL's EVP_EncryptUpdate function, specifically why does it return different cipher-text for same plaintext, key and IV (initially provided), over multiple ...
prd-ld's user avatar
  • 13
0 votes
1 answer
141 views

crypto_secretbox_easy appends several '[NUL]' characters to the end of text

I have created two functions 'encryptf', and 'decrytpf' (named with 'f' to avoid naming conflict with pre-existing libsodium functions. These functions are pretty self explanatory, they encrypt, and ...
thou mother's user avatar
0 votes
1 answer
114 views

I have written the code of affine cipher in C. It correctly encrypts/decrypts the uppercase letters but incorrectly encrypts/decrypts lowercase letter

#include <stdio.h> #include <stdlib.h> #include <time.h> # define MAX_LENGTH 100 int GCD(int a, int b) { if(b == 0) { return a; } GCD(b, a%b); } struct Pair{ ...
Omen's user avatar
  • 1
1 vote
0 answers
55 views

Trying to use OQS-OpenSSL_1_1_1 in Golang

I'm use open-quantum-safe/openssl to create certificates and key pairs , now i want to use this library(https://github.com/open-quantum-safe/openssl) to create certs & keys using golang so i can ...
O21's user avatar
  • 31
0 votes
1 answer
150 views

CryptDecrypt function fails with NTE_BAD_DATA in C

Im trying to decrypt a .png file but for some reson CryptDecrypt returns Bad Data error. I'm new to C and Cryptography so it would be awesome if someone could tell me why is it happaning and how to ...
Michał Jankowski's user avatar
2 votes
0 answers
58 views

LibTomcrypt Invalid input packet while decrypting

Im trying to create an API from C to Lua for lua can use ecc_encrypt and decrypt from libtomcrypt, for it have the function encrypt that encrypt the mensage given by blocks and when im trying do ...
Breno Marot's user avatar
1 vote
1 answer
97 views

Problem with the out put of the ecc_decryption_key using libtomcrypt in C

I Have the following simple code. Im just initializing the parameters, calling a make_key function, encrypting the data and trying to decrypted the data #define LTM_DESC #include <tomcrypt.h> ...
Breno Marot's user avatar
1 vote
1 answer
151 views

Use "/dev/urandom" with GMP library to generate a very big random number

I'm using Debian Bookworm and GMP library version 60201. I need to generate a random number with GMP library but I have 2 requirements, if possible, of course! 1 - Generate a number between 0 and a ...
PsySc0rpi0n's user avatar
1 vote
1 answer
213 views

tpm2.LoadExternal() throws error code 0x16 : unsupported symmetric algorithm or key size, or not appropriate for instance Error

I have a DPE application and I am doing client.Sign of a message. This function returns a signature, a certificate from which we can get public key and other few things. I have extracted the public ...
Vijay's user avatar
  • 21
0 votes
0 answers
90 views

Macro Defined Functions - Compiling Error

I am trying to compile and create executable for the dilithium2 algorithm which is a Quantum Cryptography Project. I am getting into trouble with using macro defined functions in my compiling process. ...
Kanije Ashine Shie Shuai's user avatar
1 vote
1 answer
66 views

gnutls_cipher_encrypt2 returns "The request is invalid."

I'm messing around with GnuTLS and I want to write a C program which encrypts/decrypts a file using the GnuTLS functions. #include <stdio.h> #include <stdlib.h> #include <string.h> #...
David Dudas's user avatar
0 votes
1 answer
410 views

Setting EVP_PKEY_RSA_PSS key type to EVP_PKEY* object leads to segmentation fault in C

I have a C code which creates a public key from exponent and modulus of a JWK data. Leave about JWK data here. here the generated public key is in EVP_PKEY* format and its type is "EVP_PKEY_RSA&...
Vijay's user avatar
  • 21
0 votes
0 answers
205 views

JWT token verification fails in C

I am trying to verify JWT token which has PS384 algorithm in its header. I am trying using this library. This provides some sample applications also including RS256 algorithm. and it is mentioned that ...
Vijay's user avatar
  • 21
0 votes
0 answers
134 views

STM32F7 problem with FreeRTOS and Cryptographic Library

Im using STM32F723 and using the Cryptographic Library (https://wiki.stmicroelectronics.cn/stm32mcu/wiki/Security:Getting_started_with_the_Cryptographic_Library). When testing basic cmox_aead_encrypt ...
CoObri's user avatar
  • 23
0 votes
1 answer
264 views

RSA Signature generated by X-Cube Crypto Library (Embedded C) and Python script are not matching even though we used same key for both methods

My application to generate SHA256 hash value for the "xx_xx.hex " file and then generate RSA signature for hash . SHA256 value generated by X-Cube-CRYPTOLIB and python script both are same. ...
cherry411's user avatar
0 votes
1 answer
117 views

RSA Decryption in C: Can't get the correct message

Good night, guys. I am struggling for a week with an exercise of programming in C. It was basically: "Imagine you know my public RSA key which has the modulus n = 16076635963 and the public ...
user3587527's user avatar
0 votes
1 answer
194 views

How to fetch supported public-key algorithms from OpenSSL 3.0?

Currently I use EVP_PKEY_meth_get_count(), EVP_PKEY_meth_get0 and suchlike calls to fetch list of supported public-key algorithms. However, OpenSSL 3.0 deprecates their usage. Which API should be used ...
Nickolay Olshevsky's user avatar
2 votes
0 answers
84 views

How to get the VB6 PRNG to generate a byte output from a specific seed, and how to replicate in C?

Long time reader and lurker, first time poster. I'm hoping to get some help regarding an old problem that has eluded me. I'm trying to figure out how the VB6 PRNG was used to generate a byte output ...
Aky83's user avatar
  • 29
1 vote
0 answers
66 views

What is the easiest way to create a secured network client in Linux (C) without any external libraries?

As i said, i want to create a secured network connection (TSL/QUIC/...) in C for Linux. Is there a easy way to create that directly based on the linux standard libraries without OpenSSL or other ...
Stevie's user avatar
  • 451
0 votes
0 answers
58 views

When inserting lkm rootkit the kernel crashes

I am writing an lkm rootkit for ubuntu 5.19.0-35-generic 20.04 tls server, found here. I have a program that updates the hex string of a big int, and whenever I run it the entire kernel crashes. int ...
user avatar
1 vote
0 answers
156 views

GMP library usage cause memory exhaustion

I am using GMP library for large number of calculation. I have checked through valgrind that there is no memory leaks in program for small numbers of calculations. But when I try to calculate large ...
Anurag Jain's user avatar
0 votes
0 answers
76 views

How would I do big math whilst operating withing the kernel?

I am making a client for a server that operates in kernel-space and am attempting to write my own protocol for encryption, mostly due to the fact that it seems fun but also because no user-space ...
user avatar
2 votes
1 answer
4k views

What does OPENSSL_NO_DEPRECATED_3_0 mean?

For example, consider this snippet: # ifndef OPENSSL_NO_DEPRECATED_3_0 OSSL_DEPRECATEDIN_3_0 size_t HMAC_size(const HMAC_CTX *e); OSSL_DEPRECATEDIN_3_0 HMAC_CTX *HMAC_CTX_new(void); ...
ayivaak's user avatar
  • 125
1 vote
2 answers
2k views

mbedTLS ECDSA verification fails

I am porting one ECC ECDSA verify library to mbedTLS to benefit from large pool of crypto functions and I'm at a point where after 2 nights, I'm not able to verify the signature. It works well with ...
unalignedmemoryaccess's user avatar
-3 votes
1 answer
106 views

Access Violation only with large values, but working with small ones [closed]

I am working on a C method to find the inverse of a number mod n, and it works perfectly fine when for example I call this method with 6.0 and 65537.0, it gives me the correct result, even when ...
Miguel Rodriguez'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
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
2 votes
1 answer
99 views

Why do I have inconsistent evaluation of cipher and corresponding plain message using RSA algorithm?

Rationale To simulate the RSA algorithm in C using a robust command-line application written in C. Here is my problem: Taking values of e=7, p=3 and q=11 works fine when encrypting and decrypting. ...
thetva's user avatar
  • 153
0 votes
0 answers
231 views

WolfSSL Settings.h File shows some error during the project building. it shows Unresolved inclution: "stm32f4xx"

I am still studing about the WolfSSL Library. I'm usng Nucleo-STM32L476RG to run the programm.After generating the code,i try to build the code and then it shows error in settings.h file. The error ...
Yasantha Biyuranga's user avatar

1
2 3 4 5
13