6,963 questions
0
votes
0
answers
75
views
Dart SecurityContext not accepting programmatically generated RSA private key for Android TV Remote Protocol
I'm building a Flutter app that uses Android TV Remote Protocol v2. The app requires client certificates for authentication. When I use a manually created certificate (placed in assets), everything ...
1
vote
0
answers
78
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 ...
0
votes
1
answer
133
views
rsa.ImportFromPem(privateKeyString) throws strange error in ASP.NET Core 6.0 Web API [closed]
using (RSA rsa = RSA.Create())
{
rsa.ImportFromPem(privateKeyString);
byte[] dataToSign = Encoding.UTF8.GetBytes(signData);
byte[] signedData = rsa.SignData(dataToSign, HashAlgorithmName....
0
votes
0
answers
90
views
Get date from TimeStampToken equivalent in Typescript
I have a web service that returns a Timestamp Token as a base64 string,
I have this code in Java using BouncyCastle to parse, open and extract the date:
String timestamp = "...";
byte[] ...
0
votes
0
answers
61
views
How to securely connect Flutter to a Node.js server with TLS or RSA encryption?
I'm building a Flutter app that needs to send user data (like name and street) to a Node.js backend server. Currently, the data is sent via URL like this:
http://192.168.1.126:8080/save?name=toto&...
1
vote
1
answer
82
views
inconsistency in RSA algorithm when using pycryptodome
I am using python3-pycryptodome version 3.9.0-150200.9.1 on openSUSE Leap version 15.6.
While using Crypto.PublicKey.RSA class, I noticed that generated RSA keys have some algorithmic inconsistency.
...
0
votes
0
answers
99
views
How to extract private part of RSA key from Azure Key Vault?
I'm using Java & Spring Boot for an endpoint which sole purpose is to create, sign and issue JWT. The library used for creating JWTs is java-jwt. I have a problem creating a com.auth0.jwt....
0
votes
0
answers
74
views
TCP socket server hangs randomly and rsa Decryption error raised randomly
I'm trying to make a server for a password manager I'm building, but the server seems to hang randomly and it seems to randomly throw rsa.pkcs1.DecryptionErrors randomly too. I did recently switch ...
0
votes
0
answers
92
views
Cybersource microform upgrade from V0.4 to V2 -Validation of the Context key with the public key is getting failed
Here is the class that am using ,based on the flow that I have ,the validation always fails and return false in the line boolean isValid = signature.verify(signatureBytes);
LOG.info("Signature ...
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
0
answers
87
views
RSA with nodejs and flutter Error during decryption (probably incorrect key). Original error: Error: error:02000079:rsa routines::oaep decoding error
I am experimenting with developing rsa with flutter and nodejs. public.pem and private.pem are same for both. Both the code are working fine when run in same language. but when transmitting data over ...
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
53
views
Input format for public key in EU command on payShield 10K
I'm working with a Thales payShield 10K and trying to use the EU command to translate a public key under new LMK.
I currently have the key available in PEM, DER, and HEX formats. However, according to ...
-2
votes
1
answer
110
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 ...
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 ...
0
votes
1
answer
183
views
Is it normal that public key generated from private key are different each time?
I have a C source code that generate a 2048 bit RSA key (it's working, no problem with it) :
int main(void)
{
RSA *lptypRSA = NULL;
BIGNUM *lptypBIGNUM = NULL;
BIO *lptypBIOPublic = NULL;
...
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
1
answer
213
views
RSA/ECB/PKCS1PADDING encryption port from java to Python [duplicate]
I have a Java code given to me by a vendor where we generate signature of the payload and send the signature along with the payload in the request. The signature is the same for the same payload no ...
0
votes
2
answers
131
views
RSA encryption and decryption for special characters (àâäèéêë)
I am using Angular to encrypt the payload with publickey
publicKey: string = `-----BEGIN PUBLIC KEY-----
-----END PUBLIC KEY-----`;
let encryptedCredential = {};
const rsa = Forge.pki....
0
votes
2
answers
201
views
RSA encrypting a string with private key - Crypt_RSA replacment
I got a PHP application that has to encrypt a string with a private key. It's a bit uncommon to encrypt with the private key, I know, but that's the way it is.
The application is PHP5 using a very old ...
0
votes
3
answers
445
views
How to verify the signature of a PSS (Probabilistic Signature Scheme) signed signature in C# (Tillo webhooks)
I'm working on an integration with Tillo, using signed webhooks as described here.
Tillo provide example code for signature validation in Python and PHP. However, I need an implementation in C# and so ...
2
votes
1
answer
347
views
apksigner and Azure Key Vault RSA-HSM certificates for code signing an APK
Following on from my previous adventures here apksigner ignoring java parameters when trying to include azure keyvault jca it now appears that I cannot sign using apksigner when using a RSA-HSM ...
6
votes
1
answer
210
views
C# to Python RSA implement
Just trying to rewrite this c# code to python.
Server send public key(modulus, exponent), need to encrypt it with pkcs1 padding.
using (TcpClient client = new TcpClient())
{
await client....
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 ...
2
votes
1
answer
855
views
python snowflake.connector & rsa private_key_file issue
I meet an issue when trying to use snowflake.connector with an RSA pkcs8 key with passphrase.
When I try this code, with this kind of RSA Key:
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -...
0
votes
1
answer
545
views
Use OpenSSL command line to create RSA keys and encrypt data compatible with an older embedded system?
At work, I have been assigned the task of using the OpenSSL command line (on my laptop in Cygwin) to create an RSA key pair in PEM format, and to encrypt a piece of plain data that will be decrypted ...
2
votes
0
answers
117
views
Encrypt RSA/ECB/OAEPWithSHA-256AndMGF1Padding Swift Padding error
Backend gives us publicKey and we need to encrypt with
RSA/ECB/OAEPWithSHA-256AndMGF1Padding
and send it to server.
I am using this functions :
static func encrypt(string: String, publicKey: String?)...
0
votes
0
answers
253
views
How to store an RSA private key in flutter
I have used the encrypt package to generate public and private key pairs.
Now I want to send the public key to the server via an API and store the private key in the device for future use
I was ...
0
votes
0
answers
91
views
Cannot extract public key from ASN Object
So I am trying to parse a der format file to extract the public key. I have three algos, RSA, EDDSA and ECDSA. The below code works for RSA but not for EDDSA and ECDSA. I am getting the below error
...
0
votes
0
answers
107
views
In key=joserfc.jwk.RSAKey.import_key(string) can I cache (key,string) and avoid calling import_key? (Python)
I've some Python pytests that call (indirectly)
key = joserfc.jwk.RSAKey.import_key(string).
This is pretty slow so I'm hoping there is a way I can save the (string,key) combination in a cache, and ...
0
votes
0
answers
286
views
How do I use windows ncrypt API NCryptExportKey function, to get an unencrypted certificate key, in C/C++
I want to give access to a personnel certificate to another process, in PEM format. The process uses openssl.
I successfully export the cert to a blob...but something is wrong.
NCRYPT_KEY_HANDLE ...
1
vote
1
answer
73
views
rsa signature in elixir mismatch with python code output
I have a python code for generating rsa signatures and I am trying to write this code in elixir.
python code:
import sys
import base64
import datetime
import json
from Crypto.PublicKey import RSA
from ...
0
votes
0
answers
194
views
Translate .NET 6 to .NET 4.8 ImportRSAPrivateKey in C# does not exist
I am trying to translate this C# .NET 6.0 code to run on .NET 4.8. I am trying to get a token using a RSA private key pem file. But I didn't succeed.
Please, can someone help me ?
I have a problem ...
-3
votes
1
answer
193
views
Creating RSA Public Key From String throws exception [duplicate]
I've generated this test public key using open ssl command and I am trying to turn it into a public key using KeyFactory. It just keeps giving me an InvalidKeySpecException no matter what I try. Any ...
0
votes
1
answer
317
views
Azure key vault certificate throws bad parameter error
When I upload the certificate as this:
-----BEGIN CERTIFICATE-----
{my certificate}
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
{my key}
-----END PRIVATE KEY-----
I am getting the error:
...
0
votes
1
answer
105
views
Finding root of very large number
I'm doing a CTF of my IT-Security course right now, and have to find a token for a Kerberos registration service. The server uses a faulty RSA-like encryption. (yes, this on purpose and not changeable)...
1
vote
1
answer
136
views
How to do RSA Encryption in Python using PyCryptodome
I am new to the world of encryption and I was wondering if my solution for encrypting/decrypting data is okay.
When creating this, I referenced the API documentation from PyCryptodome: https://...
1
vote
1
answer
152
views
signature generated using openssl C++ API does not match with same code in python
I have a python code which generates signature based on hash string as data. It uses cryptography library to calculate singature based on hash. It uses private key file .pem which contains private key ...
0
votes
1
answer
241
views
AEADBadTagException: mac check in GCM failed during AES decryption with BouncyCastle
I am encountering a javax.crypto.AEADBadTagException: mac check in GCM failed error when attempting to decrypt data using AES in GCM mode with BouncyCastle. The error occurs during the AES decryption ...
0
votes
0
answers
116
views
Where to store private key of RSA encryption
I am developing an ASP.NET Core Web API and want to use JWT (JSON Web Tokens) for authentication. I want to sign the tokens using RSA encryption. The API should be deployable on both Linux and Windows ...
0
votes
1
answer
122
views
how to resolve exception while reading private key from file [closed]
i am trying to read private key from a file using the below code and getting an exception. is there any way to resolve it?
generatePrivate() method throws invalidkeyspecexception.
import java.nio....
0
votes
1
answer
86
views
Unable to fetch key from Keychain in Swift
I am saving a private key to keychain and now want to retrieve it but some how not able to do it. Following is my code:
public func storeKeyToKeychain(_ key: SecKey, tag: String) -> Bool {
let ...
0
votes
1
answer
189
views
'Encrypted message length is invalid.' using node-forge to decrypt the message encrypted from jsencrypt
currently using jsencrypt and node-forge for decrypt and encrypt the message using RSA, while jsencrypt is used in frontend and node-forge in backend.
import { JSEncrypt } from 'jsencrypt'
import * as ...
0
votes
0
answers
76
views
Decode data on the client
I am currently facing the following issue:
I encrypt data using PHP, specifically Laravel, as follows:
static function encrypt($data)
{
$publicPath = base_path('public.key');
$publicKey = ...
3
votes
0
answers
156
views
Understanding issues with TPM and TSS.NET
I did a lot of research, but I still have some issues with concept of the TPM and his handling with keys.
First at all, the task is to create a RSA-Key for encryption.
We want to use this later for ...
0
votes
0
answers
101
views
Is there a limitation on the size of data (Key Material) that an AWS KMS Wrapping Key can encrypt?
I have a 4096-RSA Private key that I want to use as key material in AWS KMS to generate a KMS key.
While setting up an external key in AWS KMS, it does not let us upload a Key Material directly for ...
-2
votes
1
answer
178
views
How can encrypt\encode (Base64) for a generated key including message with 2nd public data key in OpenPGP medium? [closed]
I'm using Kleopatra after installed Gpg4win. I have generated an RSA key pair with a 1024-bit key size, using my name as the username using Windows Command Prompt. I was suppose to genearte and sign ...
-5
votes
1
answer
213
views
RSA decryption python [closed]
How to find p,q,a if they random?
i have this script
from Crypto.Util.number import getPrime
p,q = getPrime(256), getPrime(256)
n = p*q
a = getPrime(128)
c1 = (p-a)**2>>128
c2 = (q+a)**2>>...
0
votes
1
answer
121
views
Digital Signature of Hash (HMACSHA256) in Java using SHA256 algorithm & Pkcs1 RSA signature padding didn't match with dot net implementation
I am trying to create digital signature of the hash (created using HMACSHA256) in Java using SHA256 algorithm & Pkcs1 RSA signature padding but it is not producing the same signature as ...
0
votes
0
answers
90
views
openssl not compatible with forge library?
I am trying to encrypt a message using forge Javascript library and to decipher it using Openssl library suite using RSA algorithm. For some reason, the encrypted message is so corrupt, it can not be ...