15,247 questions
-7
votes
0
answers
64
views
Decoding text by frequency analysis
I'm doing a lab on information security. I can't decrypt the text. I started the work with a literal logical selection:
I assumed that each letter in ascending order is a specific letter in the ...
Advice
0
votes
0
replies
77
views
Design review: ntfy-based remote unlock for Vaultwarden without exposing .env passphrase on a compromised host?
(If you want to skip to the part I ask the question, scroll down to the last section with the heading "Concrete question".)
I’m working on a home lab / learning project and would appreciate ...
2
votes
1
answer
110
views
The operation failed for an operation-specific reason: Cipher job failed
I have the following code that should encrypt a string with a password in nodeJS. You can find an example here: https://jsfiddle.net/ujr4gev3/1/
I have also tried the approach here: https://gist....
2
votes
1
answer
188
views
Upgrading PHP scripts to use phpseclib3 versus phpseclib version 2
I am trying to upgrade my phpseclib-based scripts to the latest, which is version 3. (Previously, I was using version 2.) I have run into a number of problems, beginning with the fact that class ...
2
votes
2
answers
146
views
Storing biometric data in a PDF without breaking the digital signature
I'm developing a tool that stores a signer's biometric data inside a PDF together with the digital signature, but I'm unsure where this information should be embedded.
The biometric data is captured ...
Advice
0
votes
1
replies
93
views
What are other alternatives for python keyring?
I'm trying to find a secure way to store token for my cli application. In the app I take the token from ms entra id and I want to store this token in user computer so that user can use it again until ...
0
votes
1
answer
143
views
Calculating DigestValue of SignedProperties in XAdES
I am trying to create an application to sign xml documents in xades format by using PKCS11Interop library. I have a xades sign application provided by a government institute to test my results. I am ...
1
vote
1
answer
143
views
Migrating from OpenSSL 1.1 to 3.0: How to generate DH key pair with 32-byte prime using EVP_PKEY-DH interface?
I'm migrating my Diffie-Hellman (DH) implementation from OpenSSL 1.1 to OpenSSL 3.0. Previously, I used APIs like DH_set0_pqg, but these are now deprecated. I am switching to the EVP_PKEY-DH interface ...
1
vote
0
answers
139
views
Why does EVP_PKEY_derive_set_peer cause a segmentation fault when using a peer public key reconstructed from BIGNUM in OpenSSL 3?
I'm using OpenSSL 3.0 EVP_PKEY in C to perform Diffie-Hellman key exchange. I generate Alice's and Bob's key pairs. I extract Bob's public key as a BIGNUM and try to reconstruct an EVP_PKEY for Bob's ...
0
votes
0
answers
94
views
Signing JWT not working: An exception of type 'System.MethodAccessException' occurred
I'm trying to sign a JWT with a key that is stored in an Azure Keyvault using the keyvault as signer, in a way that the actual private part of the key never leaves the keyvault.
I've come-up with the ...
1
vote
0
answers
79
views
RSA based certs failing during TLS after removal of RSA-PSS ciphers from ClientSignatureAlgorithm
For FIPS mode, I added ClientSignatureAlgorithm in opensslcnf.txt. This change was done for FIPS mode using the crypto-policies package.
The support ciphers for ClientSignatureAlgorithms are same as ...
2
votes
1
answer
314
views
Does this function result in uniformly distributed integers?
Recently, on a project, I encountered the need for uniformly distributed integers within an arbitrary range [a, b] from random bytes, a problem that is quite common and is usually solved using ...
2
votes
0
answers
72
views
Using OpenSSL provider to delegate TLS_PSK_WITH_NULL_SHA256 key operations to TZ or TPM
I am developing software that uses OpenSSL for implementing a TLS client. I am developing it in the C++ language, to run in Linux for ARM 64-bit.
I intend to use the cipher TLS_PSK_WITH_NULL_SHA256.
...
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
0
answers
182
views
Why is my crypto.getRandomValues() base36 ID generator producing duplicates despite 2.8 trillion possibilities?
Here is the function:
export function generateId(): string {
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let result = "";
const randomArray = new Uint8Array(8);
...
1
vote
1
answer
88
views
Azure container app crashing while computing hash for large files
I have a piece of code deployed in Azure Container Apps that primarily copies the file from the staging Azure blob storage to the final Azure blob storage and computes the SHA256 hash.
However, I have ...
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):...
1
vote
0
answers
70
views
How to know a security provider supports a specific keysize without trying to init?
The Cipher states that Java platforms require to support following transformations and keysizes.
AES/CBC/NoPadding (128)
AES/CBC/PKCS5Padding (128)
AES/ECB/NoPadding (128)
AES/ECB/PKCS5Padding (128)
...
0
votes
0
answers
70
views
ADKG-based threshold ECDSA signature recovers different address per transaction—how to compute aggregate `r` and signature parameters?
Background
I’m implementing Asynchronous Distributed Key Generation (ADKG) over secp256k1 so that N nodes collectively hold a threshold private key. After DKG each node has a secret share. To sign an ...
3
votes
0
answers
139
views
Python requests library refusing to accept correct verify certificate
The following application performs a basic HTTP GET request against https://google.com, retrieves the peer certificate and saves it in PEM format into a file called cert.pem.
After that it attempts ...
2
votes
1
answer
91
views
How to handle Disposing of CryptoStream after exception occurs during decrypt
C# .Net Framework 4.8.
I am using CryptoStream Reader to decrypt an encrypted datastream within a Using {} block.
If the Key used for decryption is incorrect, the CryptoStream Reader throws an ...
1
vote
1
answer
89
views
Why does the round trip from creation of self-signed EC X509Certificate to PEM file to load fails in .NET 9?
Here is the .NET 9 code that creates a self-signed EC cert, persists to a .PEM file and attempts re-create the certificate from the .PEM file.
// Generate ECC key pair
using var ecdsa = ECDsa....
0
votes
1
answer
128
views
cryptography and pyinstaller (not using Fernet) error
I'm using pyinstaller main2.spec command. The main2.spec file is the next:
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[
('./...
1
vote
1
answer
86
views
What are session objects? Where are they stored? [closed]
The question is about where session objects are created and stored - on a token or in RAM of an application that uses a pkcs11 library?
It seems that pkcs11 specification does not differentiate them ...
1
vote
1
answer
194
views
Validating an Ed25519 public key (isOnCurve check) in Java
Is there a standard way to validate an Ed25519 public key (check that it's really a point on the curve and not some random bytes) using the standard Java Crypto APIs and/or BouncyCastle?
I found a ...
1
vote
1
answer
140
views
How does U32C in ChaCha20 bypass endianness concerns?
While reading the ChaCha20 cipher's source code, I noticed something unusual. The algorithm's constants (like 0x61707865) aren't converted for endianness, yet this doesn't cause issues across ...
0
votes
1
answer
170
views
Incorrect Injective address from mnemonic using DirectSecp256k1HdWallet with custom HD path
I'm trying to derive a bech32 address on the Injective chain using a mnemonic and the Ethereum HD path (m/44'/60'/0'/0/0). Here's the code I'm using:
import { DirectSecp256k1HdWallet } from '@cosmjs/...
1
vote
1
answer
81
views
Migration from SmartCard .Net technology to JavaCard
I have a .Net application, let's call it MyApplicationDotNet, that currently communicates with Gemalto IdPrime 510 smartcards based on .Net technology, I need to make it use javacard. Is it necessary ...
0
votes
1
answer
169
views
C# Signing Logic for a Tron transaction
I am attempting to sign a transaction created using TronGrid's https://api.trongrid.io/wallet/createtransaction endpoint. My current code looks like this, where JsonNode txNode passed to ...
0
votes
0
answers
108
views
Aptos SDK: "INVALID_SIGNATURE" error when submitting transaction signed via Fireblocks
I’m using Fireblocks raw signing to sign Aptos transactions because it holds the private key. I generated the Aptos address from the public key provided by Fireblocks, and this address can receive ...
0
votes
0
answers
117
views
TR34 Sample Enveloped Data
I have a TR34 sample enveloped data from X9 TR34–2012.
I am trying to decrypt it, but I am not sure which part of the token contains encrypted ephemeral key and which exact rsa algorithm is used for ...
0
votes
0
answers
67
views
Using lattice estimator with Sage
I'm looking to use the lattice-estimator here: https://github.com/malb/lattice-estimator?tab=readme-ov-file which depends on SageMath.
I have installed SageMath here:
john@sage:~/Downloads/sage-10.6$ ...
-2
votes
1
answer
111
views
Key unwrapping fails
I want to protect a RSA private key stored in localStorage by wrapping it with a key derived from the user's password.
However when unwrapping the key the error DOMException: An invalid or illegal ...
0
votes
1
answer
114
views
ECDSA-signed JWT validation failures between .NET and PHP
Why does a ECDSA-signed JWT in .NET fail validation in PHP when using OpenSSL, even with matching keys and algorithms?
In .NET using System.Security.Cryptography and System.IdentityModel.Tokens.Jwt ...
1
vote
1
answer
90
views
Can't align RSA encryption in Python and Kotlin
I would like to add RSA encryption in my server (Python FastAPI) and my Android app.
But the encryption didn't work as the way I expected.
I already have AES-GCM encryption/decryption working between ...
2
votes
1
answer
182
views
Lattice attack against single signature : how to modify the b1 and c1 constants in order to get the script working against smaller leaks?
The following script I found here. The idea explained here is that if for a single signature both the high order bits of the private key and nonce are set to 0, then it’s possible to combine those 2 ...
1
vote
1
answer
133
views
How to read the public key's exponent and the modulus using System.Formats.Asn1.AsnReader in C#
The goal is to read a certificate and parse the ASN.1 elements for further use.
I managed to instantiate the reader as follows with no issues:
AsnReader readerAll = new AsnReader(new ReadOnlyMemory&...
0
votes
0
answers
86
views
Is it secure to store only the aggregated BLS public key in a smart contract for signature verification?
I have a question regarding BLS signatures and aggregate signature verification in smart contracts.
Let’s say I have 3 honest signers, each with their own private key. They all sign the same message, ...
1
vote
0
answers
95
views
How to persist a string in the TPM by using the ESYS API?
I want to store a short string like "foo: bar, abc: def" inside of the TPM.
While tss2 CLI commands seem to work pretty well in doing so, I feel pretty lost in trying to achieve the same ...
-1
votes
1
answer
106
views
How can I securely integrate a crypto wallet connection (e.g., MetaMask) on a landing page built with React?
I'm building a crypto-focused landing page (https://blockwealth.com.au/cryptolandingpage/) using React, and I want to allow users to connect their MetaMask wallet for potential interactions like token ...
2
votes
0
answers
190
views
How to calculate and derive secret from account credentials to create cryptographic key on the server
I am having problem deriving secret from account credential to create a key password which will enable me to create a cryptographic key on the server.
The calculation of the signatures (Key signature ...
0
votes
1
answer
164
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). ...
0
votes
1
answer
158
views
How do I create a shared 128-bit AES-GCM key using ECDH?
Given a supplied public key, plus my own private key, how do I generate "a shared 128-bit AES-GCM key... using ECDH", using something suitable for the JVM and/or Android?
The Tesla Fleet ...
0
votes
0
answers
136
views
Recreating TPM (Trusted platform module) PCR 10 from Linux IMA (Integrity Measurement Architectur) log
I created a VM on google cloud platform. After creating it, I edited /etc/default/grub file by adding additional kernel command line parameters so that I would enable IMA module:
...
0
votes
0
answers
99
views
Which Should I Choose: SHA256withRSA or SHA512withRSA for Android App Keystore?
I'm in the process of generating a keystore for signing my Android app, and I'm wondering about the best choice for the signature algorithm. My current command is as follows:
KeyTool.exe -genkey -v ^
-...
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
0
answers
64
views
Android SQLite DB encryption for FIPS compliance without SQLCipher
We're working on getting our Android app FedRAMP certified and are looking for a solution to encrypt our database with a FIPS-validated cryptographic provider. SQLCipher offers this capability, but ...
-3
votes
2
answers
297
views
Encryption not working using C# System.Security.Cryptography
I was trying to decrypt a JSON request with a key, hex and textbody but all the codes I found are from 2013 - 2017. I tried using this one
namespace AES {
using System.IO;
using System;
...
0
votes
0
answers
93
views
Generating HMAC-SHA256 Token in JavaScript to Match PHP Output
I am trying to call an API written in PHP that generates a token using the following method:
base64_encode(hash_hmac("sha256", "<api-key>", "<email>:<gmdate('y-...