3,167
questions
1
vote
1
answer
31
views
Convert Ed25519PrivateKeyParameters to PKCS8
I have generated an Ed25519 key pair using bouncy castle. For my own source of randomness I need to use BC.
Converting it to PKCS8, to be able to use the key without BC, the encoded key spec is not ...
0
votes
0
answers
21
views
C# BouncyCastle FIPS Elliptical Curve Encryption/Decryption
I have successfully implemented encryption/decryption/signing for AES, RSA and EC using BouncyCastle NOT in FIPS mode, but the FIPS API is very different than Non-FIPS. Concrete examples are sparse, ...
0
votes
1
answer
37
views
How to create CMS from an existing signature (generated by a Remote Signing Service)?
I created a CMS signature using an existing signature generated by a Remote Signing Service.
Before that, I hashed the message to be signed with SHA256, then I sent it to the Remote Signing Service ...
0
votes
0
answers
40
views
How to use ML-KEM/Kyber for encrypting data using PublicKey and decrypting data using PrivateKey
I am learning how to use Post quantum cryptography with Java. The vendor implementation is provided by BouncyCastle version 1.78.1. In short, I'm using a BouncyCastlePQCProvider to obtain a Key Pair ...
-2
votes
1
answer
52
views
PublicKey (JDK) to ECPublicKey (BC)
I java a public key out of a X509 certificate.
I try to get it to an object of ECPublicKey of BouncyCastle.
Tried it with casting - gets casting exception.
void foo (X509Certificate cert)
{
java....
1
vote
1
answer
113
views
How to do X25519 ECDH with a round of HSalsa20 to produce the shared secret key specified by NaCl and libsodium using BouncyCastle?
While trying to implement the "Authenticated encryption" scheme of libsodium using BouncyCastle I naively performed simple X25519 key agreement to obtain a javax.crypto.SecretKey object.
I.e....
0
votes
0
answers
25
views
How to sign Pdf using iTextSharp 4.1.6 and certificate marked non-exportable, located in Windows Certificate Store
I have been able to sign a document with a certificate that was installed on the machine with "export key" option enabled. But when I try the same thing with a non-exportable certificate, it ...
7
votes
1
answer
184
views
+50
Java-Generated Private Key Imports in Chrome but Fails in Safari
I am working on a project where I generate an EC private key using Java and then import it in the browser using JavaScript. The key imports successfully in Chrome, but it fails in Safari.Here’s my ...
-1
votes
0
answers
52
views
Key derivation (ConcatKDF) with BouncyCastle
I have a secret that is generated from a ECDH key agreement (my privat key and the partners public key).
X509Certificate cert; // partners
PrivateKey privk; // mine
// ...
KeyAgreement ka = ...
0
votes
1
answer
72
views
C# (.NET 4.8) - Verify signature using Public Key
I need to verify signature of a JSON webhook. In the documentation there is only JavaScript example of how to do this:
const crypto = require("crypto");
const fs = require('fs');
const ...
0
votes
0
answers
54
views
Uploading PGP Secret Key to Azure Key Vault
We're using BouncyCastle.Cryptography (2.4.0) to create a pair of RSA type public and private keys to encrypt/decrypt files. We use password protection on the keys.
We're able to successfully encrypt ...
-1
votes
1
answer
30
views
Create CertPath from Base64 bytestring
I create a Certificate Path with Java.
It is presented as an object CertPath and then as a Base64 string for output.
// certificates that build a chain: rootcert -> intermediatecert -> mycert
...
0
votes
1
answer
52
views
Pkcs11interop CKR_FUNCTION_NOT_PARALLEL Error
I have developed a worker service in C# Core that signs files using a certificate stored in a USB token with PKCS11Interop. The service creates two Tasks, each intended to sign files with a different ...
1
vote
1
answer
48
views
How to convert ssh public key to PublicKey in java
I want to convert my ssh public key in *.pub file to a PublicKey(java.security.PublicKey).
The reason is that I need to inspect the algorithm of the ssh public key, is there any way to do that?
since ...
0
votes
1
answer
86
views
AES GCM Java BouncyCastle decryption fails second time
Using the below lines of code for Encrypting and Decrypting using BouncyCastle for decrypting data received from a 3rd party source based on C. First encryption and decryption works fine(basis the ...
0
votes
0
answers
85
views
Generating RSA Signature in C# Without CRT Parameters Using System.Security.Cryptography or BouncyCastle
I'm working on a C# application (Framework 4.7.2, Visual Studio 2019, upgrading is not an option) that needs to generate a signature for a given sequence of bytes using RSA. My dataset contains only ...
1
vote
1
answer
180
views
How do I use XSalsa20 and Poly1305 primitives in Bouncycastle for AEAD
I want to use BouncyCastle to immitate the default AEAD scheme of libsodium (X25519 ECDH followed by XSalsa20 symmetric cipher with Poly1305 KDF).
I was able to do the DH with X25519 KeyAgreement to ...
0
votes
1
answer
42
views
The type org.bouncycastle.cms.cmsutils is not visible
I want to subclass some BC classes, in my Java project, but I faced issue with import of CMSUtils class. In order to reproduce issue in a simple project, I created quick-start Maven project (Eclipse ...
0
votes
1
answer
82
views
No RSA/ECB/OAEPPadding on Red Hat 8
I'm not versed in cryptography and am pulling my hair out. I have the following (simplified) setup and code.
Maven setup to use BouncyCastle
<dependency>
<groupId>org.bouncycastle</...
0
votes
1
answer
52
views
Tomcat - Java11 - Unable to present ECDSA certificate during SSL handshake as client
Recently, our organisation migrated one of our Java application codes from Java 8 to Java 11. Now, we are facing one unique issue with our application. Our tomcat server is running into a strange ...
0
votes
1
answer
96
views
java.lang.IllegalArgumentException: Invalid point encoding 0x30
I have a public key, and its corresponded signature, R, S values generated by nodejs (v20.14.0) with the function as below
const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', {
...
0
votes
0
answers
38
views
Spring-Boot HTTPS-server with special SSLContext enabled
I have a standard Spring-Boot 3 app that has configured an embedded webserver (standard Tomcat) with TLS.
pom.xml
...
<dependency>
<groupId>org.springframework.boot</...
0
votes
0
answers
52
views
Create single jar for a project with Bouncy Castle dependencies that can run on Oracle JRE
I'm making a project that has dependencies (also made by me) that themselves depend on Bouncy Castle, which includes signature files for its jar, and if these are present in the shaded jar, the JVM ...
0
votes
0
answers
159
views
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.bouncycastle.jce.provider.BouncyCastleProvider"
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.bouncycastle.jce.provider.BouncyCastleProvider" on path: DexPathList[***]at dalvik.system.BaseDexClassLoader.findClass(...
0
votes
0
answers
87
views
org.bouncycastle.crypto.fips.FipsOperationError: Module checksum failed: expected
I am using below driver and dependency packages
<dependency>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc-fips</artifactId>
...
-1
votes
1
answer
122
views
AWS - createCertificateFromCsr - Fail to connect
till now we created a certificate using sdk method IotClient.CreateKeysAndCertificate. And easily manage to connect from the client side with the private key and certificate using iot device sdk
...
0
votes
1
answer
100
views
EOT,ETX in base64 encoded bouncy castle signature
I have a function that uses Bouncy Castle libraries (version bouncy castle: jdk15on-1.57 and java 8) to sign a string and return the base64 value of the signed string (including the content of the ...
0
votes
0
answers
86
views
Unable to verify the signature generated using Bouncy Castle in Java 17
So I had a code from Java 8 which is working fine for 3rd party API. Its properly generating the signature and verifying on client code but when I moved the same code to Java 17 it started giving ...
0
votes
0
answers
75
views
How to generate X25519 key pairs with length 44 characters in Base64?
I am a java programmer. I am intended to generate a set of keypair with "X25519" instance.
I am using JDK 8, hence I am implementing BouncyCastle library to achieve this.
The BC version I am ...
-1
votes
1
answer
99
views
Import Java created .p12 into macos keychain fails with invalid password
I have a Java application which creates .p12 files (with Bouncycastle (BC)). I'm not able to import the .p12 file created via Java into macOS (macos 11) keychain:
security import mycert-personauth....
0
votes
0
answers
24
views
PgpEncryptedDataList object is giving null
When I am trying to decrypt a PGP file with having valid phrase and private key, PgpEncryptedDataList object is giving null. Below is the code snippet:-
public static void DecryptStream(Stream ...
0
votes
0
answers
133
views
iText and BouncyCastle Type Bind Conflicts
I have NET Core 5.0 project that contains itext7.bouncy-castle-fips-adapter library 8.0.4 for work with PDF and TIFF files. This adapter contains self-implemented BouncyCastle (with same namespaces as ...
0
votes
1
answer
70
views
How To verify Ascii-Armored data after decryption in PGP using Bouncy Castle?
I'm relatively new to PGP and bouncy castle. After signing a message, get a ascii-armored data back. Let's assume this ascii-armored data is encrypted and decrypted and waiting for sign verification. ...
0
votes
0
answers
30
views
.NET RSACryptoServiceProvider throws "Access is denied." in GitLab hosted runner
I have some C# code (.NET Framework 4.7.2 - unfortunately can't be upgraded) that generates an RSA key pair using the BouncyCastle library, and then converts it to the .NET-native RSA:
var ...
0
votes
0
answers
35
views
org.bouncycastle.jce.PKCS10CertificationRequest is not accessible
I am using bouncy castle library, and getting not accesible error while importing a class
I am using Java17
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security....
0
votes
0
answers
210
views
What is the purpose of the bcfks format
I have a .jks file that's being used for the keystore to launch an application through tomcat 9.
I believe the .jks file isn't FIPS compliant because some of the algorithms being used are SHA1. Which ...
0
votes
0
answers
174
views
Convert jks keystore to bouncy castle fips compliant format with expired keys
I'm trying to get an application running on a RHEL8 server using Apache Tomcat 9. The application launches as soon as I turn FIPS mode off on my server. So I suspect it has something to do with the ...
1
vote
1
answer
83
views
My exportable private key isn't exportable
Note: the answer can come in either VB.NET or C#. I have no preference for this Q&A.
I'm using the Certes and Bouncy Castle-based code below to finalize, generate and import a Let's Encrypt TLS ...
0
votes
0
answers
55
views
Generating a CSR using C# and BouncyCastle to AD CA for obtaining a digital signature
I'm creating a CSR file to request a certificate from AD CA, and I need to obtain both the public and private keys for use in digital signatures. However, in response from AD CA, I only receive the ...
1
vote
1
answer
122
views
Could not verify JWT with Curve secp256k1 in java
I am signing the JWT token using the EC key,
Code to create Keys:
ECKey ecKey = new ECKeyGenerator(Curve.SECP256K1)
.keyUse(KeyUse.SIGNATURE)
.keyID(keyId)
...
0
votes
1
answer
382
views
iText 8.0.4 upgrade: Getting error while initializing encrypted document
I am in the process of upgrading to iText 8.0.4 from 8.0.1. I have written following unit test.
public class TestEncryption extends TestCase{
public void testGenerateEncryptedPdf() {
System.out....
1
vote
0
answers
143
views
bcprov-jdk18on 1.74 upgrade failing with jcajcehelper no class found error
We bcprov-jdk16 1.44 and bcprov-jdk14 1.47 in my project pom.xml file.
as part of OSS upgrade, I have removed above jars and added bcprov-jdk18 1.74 version.
after that I am getting
java.lang....
0
votes
0
answers
101
views
java.lang.NoClassDefFoundError with upgrading bcpro-jdk15 to bcpro-jdk18on issue
We have upgraded BouncyCastle jar and getting following error at runtime
java.lang.NoClassDefFoundError with upgrading bcpro-jdk15 to bcpro-jdk18on jar BouncyCastle jars. Org.bouncycastle.jcajce....
0
votes
0
answers
39
views
PKCS#10 with Null Signature according to MS-WCCE
I am trying to create a sample Certificate Request Using CMS and CMC Request Formats with Null Signature as described in [MS-WCCE]: Windows Client Certificate Enrollment Protocol. According to the ...
0
votes
1
answer
117
views
Is possible to deploy apache-tika in a single jar using maven and javafx?
I´ve already finish a desktop application using IntelliJ, OpenJDK17, JavaFX17 in a project build with Maven.
The project runs well inside de IDE, the problems begin when I try to deploy the app in a ...
0
votes
1
answer
138
views
android.security.KeyStoreException: Incompatible purpose when integrating freeRASP library
After adding the library freeRASP Android (version 8.3.0) to our project, when trying to call a secure endpoint, we get SSLException from Retrofit/OkHttp or KeyStore Exception and our api calls fail.
...
0
votes
1
answer
163
views
How to sign a JWT with SECP256K1?
I want to sign a JWT with an elliptic curve key in Kotlin like this:
import com.nimbusds.jose.JOSEObjectType
import com.nimbusds.jose.JWSAlgorithm
import com.nimbusds.jose.JWSHeader
import com....
0
votes
0
answers
37
views
Bouncy Castle C# PemWriter.WriteObjects algorithms
is there a list of working algorithm strings for Org.BouncyCastle.OpenSsl.PemWriter in the method
public void WriteObject(object obj, string algorithm, char\[\] password, SecureRandom random)type here
...
0
votes
1
answer
148
views
Decrypt string with BC
I have a web application written using Grails 6.1.2. I have to encrypt a couple of fields in the database so I decide to use the grails-jasypt based on the famous jasypt library. It works like a charm....
0
votes
0
answers
31
views
An unhandled exception of type 'System.ArgumentException' occurred in BouncyCastle.Crypto.dll Scalar is not in the interval [1, n - 1]
static void Main(string[] args)
{
new Thread(() =>
{
GetEthPrice();
}).Start();
try
{
var web3 = new Web3("https://mainnet.infura.io/v3/...