7,354 questions
0
votes
1
answer
157
views
Why do I need an IvParameter and how do I implement it?
I'm trying to write a java program that encrypts and decrypts a byte array of text based on a password, but when decrypting, it returns an error
Error message:
Exception in thread "main" ...
0
votes
0
answers
131
views
Why am I getting "Invalid initialization vector" when calling my signed URL upload API in Node.js?
I’m working on a Node.js backend that generates a signed URL for uploading files to AWS S3 via CloudFront.
However, when I hit the signed URL endpoint from curl, I always get the following response:
{&...
5
votes
1
answer
198
views
Encrypting and decrypting with AES returns System.Byte[] [duplicate]
Using AES in C# I wrote two static methods for encryption and decryption.
Encrypt:
static byte[] Encrypt(byte[] plaintext, byte[] Key, byte[] IV)
{
byte[] encrypted_data = null;
using (Aes ...
0
votes
1
answer
197
views
Decrypting data from stream without knowing data size
Assuming we know the key and the IV for the data we're getting from the stream, is it possible to decrypt it within stream? I encrypted the same message three times and then decrypted it all at once, ...
1
vote
2
answers
118
views
pycryptodome decryption (aes-128 cbc) is yielding incorrect result
I have simple code to encrypt and decrypt as follows...
(1) To encrypt:
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
from Crypto.Hash import SHA256 as sha256
def sha(text):...
2
votes
0
answers
110
views
PSA_ERROR_INSUFFICIENT_ENTROPY when trying to encrypt plaintext
I am developing an application which uses Zephyr. I am trying to encrypt plaintext into ciphertext using AES-CCM encryption with my function as below. No matter what, psa_crypto_init() fails with ...
3
votes
1
answer
94
views
Does C# .NET AES GenerateKey (RandomNumberGenerator) truly use /dev/urandom on Linux
Generating a key and I have tried to understand how GenerateKey gets random in Linux.
Example:
using System;
using System.Security.Cryptography;
namespace AesEncryption
{
class Program
{
...
2
votes
1
answer
126
views
Difference in behavior between AesManaged and Aes.Create()
I'm porting an app from .NET framework to .NET and have notice some difference in behavior after the conversion.
Inside a library that I use (not written by me) this piece of code will behave ...
0
votes
0
answers
129
views
AES + RSA OTA updater
I am doing an OTA updater for an ESP32. I am using AWS Lambda to encrypt a presigned URL that is being generated for a certain element from an S3 bucket. I am first doing an AES encryption, and then ...
0
votes
1
answer
81
views
Is it possible create an ObjectMapper configured such that it AES encrypts all fields except fields annotated with a certain annotation?
Let's say you have an annotation configured on a per field basis:
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import ...
0
votes
1
answer
163
views
How do I do softap provisioning for an esp32-c6 in flutter?
I'm trying to write an app in flutter to perform softap provisioning for an ESP32-C6 (https://docs.espressif.com/projects/esp-idf/en/v5.4.1/esp32c6/api-reference/provisioning/wifi_provisioning.html). ...
2
votes
1
answer
91
views
StreamReader returning empty string when decrypting using Aes
public static byte[] TestEncrypt(string plainText, byte[] key, byte[] iv)
{
using Aes aes = Aes.Create();
aes.Key = key;
aes.IV = iv;
// Create a new MemoryStream object to ...
0
votes
1
answer
102
views
ggplot trouble when I combine a layer with group and a layer with group=1
I want to combine with ggplot2 a layer where I compare
three regressions and a layer where I just display three
new samples to evaluate their locations to the regressions lines.
(the mock data is ...
0
votes
0
answers
107
views
Botan aes-128 decryption not writing original text to file
I'm using the Botan 3.7.1 library to implement encryption and decryption in C++ for AES-128 in CTR mode. Currently, I'm working on a function for decryption, and it's taking the encrypted input and is ...
0
votes
1
answer
230
views
How to correctly implement the multiplication function used by GHASH function in AES-256-GCM? [closed]
I am trying to implement AES-256-GCM in Python without using any external libraries, and I have implemented encryption and decryption in AES-256-ECB, AES-256-CBC, AES-256-CTR, and AES-256-OFB modes, ...
0
votes
1
answer
81
views
Set legend in ggplot with several factor levels without using aes()
I have 2 different dataframes :
# Factor levels
species_order <- c("AMPI","LALO", "HOLA","BASA","SNBU", "WRSA", "REPH","...
0
votes
1
answer
254
views
How can I correctly implement AES-256-ECB from scratch in Python?
I am using Windows 11 and I plan to implement the code in C++. As you might know, building C++ libraries on Windows is very complicated, so I want to make sure it uses the least amount of dependencies ...
0
votes
1
answer
106
views
Chunked AES decryption in Unity got "Bad PKCS7 padding. Invalid length 0"
I'm working on a Unity project where I use AES encryption to secure video files on disk and decrypt them later for streaming through an HTTP server. While implementing chunked decryption, I ...
0
votes
0
answers
131
views
AES 256 Encryption Flutter
I've a case where I'm struggling to provide AES encryption and would appreciate some help. I'm to send an encrypted data to a hardware device which is to decrypt it and use it for some operations. The ...
1
vote
1
answer
129
views
Node crypto / tinyAES C++ round trip not working for 192/256 bit keys
I have created AES CBC ciphers via Node crypto w/ 16 byte keys - tinyAES in C++ decrypts the cipher correctly.
Ciphers created in Node crypto AES CBC using 24 byte or 32 bytes are NOT correctly ...
0
votes
0
answers
166
views
How Delphi TLbRijndael (generalization of AES) compares to PHP openssl_encrypt(...) and is it possible to achieve equal results between them?
I have database that is used by both Delphi (XE 10.4 or 11) and PHP (8+) versions and this database has some encrypted data (e.g. for the passwords) who should be handles identically between Delphi ...
1
vote
0
answers
98
views
ZIP with password protection scheme validation
I'm using ZIP format for backups of an app. Size is probably from 10Mb to 2Gb. Amount of files inside might be up to 10k.
I wanted to add a password protection but found out that both ZypCrypto (...
0
votes
2
answers
151
views
Encryption with AES-128-CTR using trezor-crypto giving different results in python
I need to work with data which was encrypted using the aes-128-ctr implementation of trezor-crypto in python. However, using pycryptodome in python to encrypt the same data with the same parameters ...
1
vote
0
answers
114
views
AES-256-GCM memory overload
I have been racking my brain over the last 3 days and hope someone can point me in the direction.
I currently have a working swift app, which is taking a file, encrypting it using AES-256-GCM and ...
1
vote
1
answer
170
views
Manually decrypting EnvelopeCms content
I have a situation where I have an envelopeCms object on disk.
It contains:
The generated AES-256 private-key encrypted using a public key
The actual payload encrypted with the generated AES-256 ...
2
votes
2
answers
202
views
Modify tiny-AES-c library to decrypt data encrypted with non-standard 128 byte AES key (CryptoJS's AES-CBC with keysize of 128 bytes)
I have some data encrypted via CryptoJS's CryptoJS.AES.encrypt(message, 'passphrase123') function. If a passphrase is supplied, CryptoJS uses the passphrase to derive an AES key and IV to encrypt the ...
0
votes
1
answer
157
views
AES-GCM Decryption Fails for Large Files in React Native Turbo Module(written with Kotlin)
Environment
Platform: React Native (Android)
Module Type: Turbo Module
Encryption: AES-GCM (with a 32-byte key)
Languages: Kotlin (for the Turbo Module) and Python (for testing)
File Sizes:
Small ...
1
vote
1
answer
74
views
Why does CryptoStream's output vary with the METHOD of the input?
I'm observing a difference in the output of AES encryption when using System.Security.Cryptography.CryptoStream depending on how I get the plaintext bytes into the CryptoStream, but I don't understand ...
0
votes
2
answers
306
views
Android Kotlin AES/GCM Decryption javax.crypto.AEADBadTagException
I'm trying to decrypt a string encoded in AES with GCM mode by another application.
When I pass my test string to my decrypt method, I get this fatal execption :
javax.crypto.AEADBadTagException: ...
1
vote
1
answer
207
views
Proper approach to encrypt large files that cannot be completed in a single function call?
I've been experimenting (from the CLI) with the encryption examples at https://www.php.net/manual/en/function.openssl-encrypt.php
and would like to know how to handle a larger file, such as a SQLite ...
2
votes
0
answers
278
views
Using the Tcl Library AES package to encrypt 10 MB file, when is initialization vector needed?
I'd like to write a Tcl script to gather my development files together into a SQLite database file and encrypt it each night to store as offsite backup on a hosting service that is shared hosting.
The ...
2
votes
1
answer
153
views
How to securely wipe xtsCipher internal key material in Go?
I'm using the golang.org/x/crypto/xts package to create an XTS-AES cipher in Go, like this:
xtsCipher, err := xts.NewCipher(aes.NewCipher, key)
if err != nil {
log.Fatal(err)
}
And I am using an ...
2
votes
1
answer
188
views
Switching from TLS_AES_128_CCM_SHA256 to TLS_AES_128_CCM_8_SHA256
Firstly I am totally new to TLS.
We are switching from TLS_AES_128_CCM_SHA256 to TLS_AES_128_CCM_8_SHA256 for a little better performance.
We are using wolfssl 5.7.6, and not really using the whole ...
1
vote
0
answers
139
views
SecureBlackBox: decode AES-256 data
I am using SerureBlackBox and I need to decode text. In the function below, when I do:
Crypto.Decrypt(@fDataBytes[0], Length(fDataBytes), @fDecryptedData[0], OutSize);
it throws an error:
Invalid ...
0
votes
0
answers
113
views
Equivalent AES-256 Encryption in Rust (Migrating from Node.js crypto.createCipher)
I want to migrating an encryption function from Node.js to Rust and need guidance on ensuring the Rust implementation behaves the same way as the Node.js crypto.createCipher method. I want to make ...
0
votes
0
answers
129
views
Getting 'bytes' object has no attribute 'encrypt' Error when using Public Key for Hybrid Encryption (Python)
I am trying to implement symmetric and asymmetric encryption in a program that has the ability to sign and encrypt, and then verify and decrypt files. I am using the cryptography hazmat primitives ...
0
votes
1
answer
153
views
CryptoJS.AES.encrypt() and Java AES encryption producing different results
I'm trying to encrypt data using AES in both JavaScript (with CryptoJS) and Java/Scala, but the Java encryption cannot be decrypted by a service while the CryptoJS version works correctly.
Here's my ...
0
votes
1
answer
117
views
Unable to print encrypted data
public class EncryptionUtil {
private static final String ALGORITHM = "AES";
public static byte[] encrypt(String data, SecretKey secretKey) throws Exception {
...
-1
votes
2
answers
127
views
Java AES encryption - How to fix IllegalBlockSizeException
I have two Java methods, one for encryption an another one for decryption. I would like to encrypt/decrypt a password with a master password. But when I try to decrypt the encrypted password i get ...
0
votes
1
answer
569
views
How to fix javax.crypto.BadPaddingException: Given final block not properly padded
I would like to implement a password safe in java. I have an EncryptionModule with two methods void encrypt(String password, String databaseName) and void decrypt(String password, String databaseName)....
0
votes
1
answer
334
views
How to decrypt MSAL auth artifact, encrypted with AES-GCM and a HKDF-derived the key?
I use @azure/msal-browser in my project.
Account information are stored in the local storage and they were exploitable until recently.
But it changed in their v4 release:
if you are using the ...
0
votes
1
answer
104
views
How to initialize cipher.init(Cipher.DECRYPT_MODE, masterKey) - IV required when decrypting. Use IvParameterSpec or AlgorithmParameters to provide it
I can not understand what wrong in this code, this is standard Android key-value service without any fantasy
private SecretKey decryptDataKey(String encryptedDataKeyString) throws ...
0
votes
0
answers
65
views
How to decrypt a code side encoded data in Postgresql using pgp_sym_decrypt function
I am using the below code to encrypt the data in Java. But when trying to decrypt it using the query
I am getting an error
Wrong key or corrupt data
SELECT pgp_sym_decrypt(
decode(email, 'base64'),...
0
votes
1
answer
150
views
When decrypting from AES random letters and numbers appear on the end of my decrypted text
The problem I am currently facing is when the decrypted data is returned from my decryption method it has random numbers and letters on the end of the text with the original data. I'm using AES ...
0
votes
0
answers
73
views
Can't use B64 decoded output as IV/ciphertext in aes256cbc decryption
I can not use the output of EVP_DecodeBlock as iv and the ciphertext for decryption use EVP_CIPHER_CTX.
When I initialise the iv or ciphertext by manually writing (with actual values and not 00's):
...
-1
votes
1
answer
108
views
Decryption of wav file in java doesn't work the files encrypted with Python script
I am trying to decrypt the WAV file encrypted with Python script. I am using the same hard-coded key in both Java and Python. I am using two different Python scripts at two different places, the ...
0
votes
0
answers
104
views
How to properly handle AES encryption in React Native and generate Random Key for AES encryption?
$aesKey = random_bytes(32); // 256-bit key
$iv = random_bytes(openssl_cipher_iv_length('aes-256-cbc'));
The above code is from PHP, and I need to do the same in React Native. I tried many packages ...
-1
votes
1
answer
87
views
Not able to store key in .jks file.I am using AES 256 algorithm and GCM mode [closed]
keytool -genseckey -alias aes256key -keyalg AES -keysize 256 -storetype JKS -keystore keystore.jks -storepass changeit -keypass changeit
1
vote
2
answers
191
views
Encrypt a string with Java for decryption using PHP
I am writing a program using Java 1.6 that should generate a message of the format:
"Your invoice #123 for 100.00 is at https://my.site.com/documents/invoice?p=xxxxxxxxxxx"
with xxxxx ...
0
votes
0
answers
229
views
CryptoJS - decrypt PBEWithHMACSHA512AndAES_256
I'd like to decrypt strings encrypted with algorithm PBEWithHMACSHA512AndAES_256 using CryptoJS.
Encrypted strings are meant for a Java Spring Jasypt application and are created in this way:
var ...