Questions tagged [jce]
Java Cryptographic Extension : a pluggable cryptography framework where various providers can bring the desired functionality
430
questions
0
votes
0
answers
45
views
Failed to create RSA keyPair in AWS CloudHSM
I am trying to create an asymmetric RSA 2048 keypair in AWS cloudHSM using 5.8.0 JCE provider. Initially the key was generated and failing to get publicKey getEncoded bytes. After generating couple of ...
1
vote
3
answers
940
views
Why does my encryption returns weird string of symbols as the encrypted text?
I am creating an algorithm where it has to encrypt and decrypt passwords by using JCE and AES. I will keep the encrypted text into a database, however I'm facing two problems. The first problem being ...
5
votes
1
answer
141
views
has anyone undergone certification of PCI-DSS using general purpose HSM (and not payshield)?
can we utilise a general purpose HSM for EMV related work ? like ARQC/ARPC ? PCI guidelines do not specifically prohibit general purpose HSM from being used. There are certain constraints (e.g. ...
0
votes
1
answer
714
views
CKR_KEY_TYPE_INCONSISTENT: when deriving signing key in FIPS mode using SunPKCS11 with NSS
Environment details:
Java: openjdk-1.8.0.312
OS: RHEL8
Following are the security providers configured.
SunPKCS11-NSS-FIPS,
SUN 1.8,
SunEC 1.8,
SunJSSE 1.8
Note:
The issue disappears when added a new ...
3
votes
0
answers
507
views
AWS KMS Support for PGP encryption
I have a batch process that require PGP encryption for files before writing them to "Archive" location.
I read a little about PGP encryption using Java and learned that Bounsycastle does ...
0
votes
0
answers
813
views
Signing using PKCS#11 tokens
Trying to read a PKCS#11 config stream and then extract certificate and private key. It is working but when trying to create a cipher instance of the private key, getting the below error:
Exception in ...
1
vote
0
answers
265
views
How to use cloudhsm java library
In the Amazon CloudHSM command line tools there is the command findKey which can take a bunch of different parameters to search for keys by type, class, label etc. The equivalent in the Java library ...
0
votes
1
answer
163
views
Problem in hiding exact size of cipherText inside image, later extract it and then decrypt it
I am having a problem in storing exact size of encrypted message inside an image.
What I want to do is that I want to encrypt a message with AES cipher and then I want to hide each byte of message in ...
1
vote
0
answers
1k
views
What is conscrypt ? Can you explain its usage with some examples?
I need to use Conscrypt in my Java application. I understand that it implements parts of the Java Cryptography Extension (JCE) and Java Secure Socket Extension (JSSE).
What code changes are required ...
0
votes
1
answer
50
views
JCE pro adding space between < & ! while commenting code in <Style> tag in editor
I just updated the JCE extension to JCE Pro(version - 2.9.10) in Joomla 3.9.27.
Now, in the article content in Joomla at the admin panel, I am adding the style tag with the comment like below
<...
0
votes
1
answer
1k
views
How is is possible that Java 11 validates a certificate whom intermediate certificate isn't avalaible in cacerts?
I don't have to fix something that doesn't work, but I try to understand why something works, because I think it should not work.
I'm using OpenJDK11 / Ubuntu 16.04. I make an HTTPS call. The SSL ...
1
vote
0
answers
641
views
Load JCKES keystore using SunJCE provider on IBM JDK
I am trying to load JCKES keystore which is using SunJCE provider in my application which is running IBM JDK 8 (power linux).
To enable my application to load keystore, I have done below steps:
...
1
vote
1
answer
154
views
Build up a cipher instance manually without getInstance
I don't seem to figure out a way to "manually" build up instance of cipher. Every tutorial and resource has same way trough Cipher.getInstance
Cipher cipher = Cipher.getInstance("AES/...
1
vote
1
answer
883
views
How do I create a PrivateKey object from private key bytes?
Say I have a seed: this is a seed that i might have lying around somewhere
I then hash the seed to produce a byte array of size 32
From what I understand (from this article), this is now my private ...
0
votes
1
answer
541
views
Spring Cloud Config encrypt endpoint giving java.lang.UnsupportedOperationException with JDK11
I want to encrypt my passwords with Spring Cloud Config Server. Below are my file changes.
bootstrap.properties
encrypt.key=%gdba$!
pom.xml
<dependency>
<groupId>org....
1
vote
1
answer
2k
views
com.cavium.provider.CaviumProvider error, I would need help to connect from my software in java to my aws hsm
i would like in my Java software to connect to my HSM (I have already configured the certificates on my aws linux interface and I managed to connect to it with the java -classpath "/opt/cloudhsm/...
3
votes
1
answer
4k
views
How to make existing Java code FIPS 140-2 compliant?
We have some Java library performing AES and RSA encryptions (using javax.crypto.Cipher).
A new requirement came in to make the code FIPS 140-2 compliant. Reading some articles what I understood is ...
0
votes
1
answer
534
views
Installing the Bouncy Castle Provider in jdk-15.0.2
I installed Bouncy Castle Provider for a Java old version configuring the Java Runtime following this guide. All worked fine. To use unrestricted policy files I installed an openJDK (15.0.2), but now ...
1
vote
1
answer
225
views
How do I programmatically install a certificate to the windows personal certificate store using Java?
In the windows personal certificate store, I am trying to programmatically install a certificate with the private key(using method setKeyEntry) using Java. But I get an exception when I do that.
...
4
votes
1
answer
1k
views
BouncyCastle JSSE and BCTLS No Credentials for Cipher
Using BouncyCastle FIPS JSSE and TLS providers for my server application.
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-fips</...
0
votes
1
answer
257
views
DestroyFailed Exception Thrown On Just Created Key
Why does this blow up when I have clearly created the key, it's in memory, and therefore should be accessible?
scala> import javax.crypto.{KeyGenerator, SecretKey}
import javax.crypto.{KeyGenerator,...
0
votes
1
answer
264
views
How to create a .crt store file containing a certificate chain from a PKCS12 one?
I have a PKCS12 file containing a certificate chain and a private key.
I would like to use BouncyCastle to create a CRT file with that cert chain, the same way we can do using OpenSSL command-line ...
0
votes
1
answer
466
views
Unlimited Security (Jasypt/WebSphere)
I am trying to encrypt a few password in a properties file using an Ant script. When I run the Ant script I get:
java.lang.RuntimeException: Security Error in doEncrypt: org.jasypt.exceptions....
0
votes
1
answer
4k
views
Caused by: java.lang.SecurityException: The jurisdiction policy files are not signed by the expected signer!
Question
What are possible ways I should dive into or could fix the issue seemingly related to JCE and MongoDB?
Brief
I've been developing a Java-based project for years. Today, I encountered an ...
0
votes
1
answer
245
views
localhost/encrypt returns not found but everything is configured
I am new in spring cloud and at this moment I'm tying create simple config server.
Now I am on a encryption step and I have installed JCE in jdk1.8 folder, also I have codes:
application.yml
server:
...
0
votes
1
answer
799
views
Java/Kotlin Output Ed25519 keypair as both JCE KeyPair instance and in OpenSSH format
I'm generating Ed25519 key pairs in my Kotlin app using the BouncyCastle library and have two requirements that are easy to implement in isolation, but seemingly difficult to do in tandem:
Provide ...
3
votes
2
answers
1k
views
How to derive an AES 256 bit key from an arbitary byte array it Java?
Given an arbitrary Java byte array for example 1024 byte array I would like to derive an AES-256 bit key. The array is generated from ECHD via javax.crypto.KeyAgreement using byte[] secret = ...
0
votes
1
answer
7k
views
Getting javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
I'm having thar error when consuming an https webservice. I have that error when running a client in Java 6. I can't change the version of the Jdk. I tried with jdk8 and it works perfectly.
What could ...
4
votes
1
answer
2k
views
How to correctly encrypt and decrypt a file using a secret key derived from a password
I am trying to work out the correct process to encrypt and decrypt a file using the "PBEWithHmacSHA256AndAES_256" standard.
From what I understand from looking at this example code from ...
0
votes
1
answer
2k
views
Encrypt and decrypt a file with streams, using an appended initalisation vector java
I have coded up a Java program which asks the user to specify a random secret key (in base 64 encoding), to specify the plaintext file to encrypt, and the name of the output file (the encrypted text ...
0
votes
2
answers
6k
views
java.io.IOException: Invalid keystore format getting while signing pdf digitally using .cer file
Dear all I have tried with below, I'm using itext7 library, your help will be appreciated thanks.
BouncyCastleProvider provider = new BouncyCastleProvider();
Security.addProvider(...
5
votes
1
answer
17k
views
How can I configure Java Cryptography Extension (JCE) in OpenJDK 11 [duplicate]
Until Java 8, it was neccessary to download and install JCE in the JDK in order to use it. I do not find a downloadable extension for Java 11. Is there a way to check if it is configured by default? ...
1
vote
2
answers
160
views
404 when trying to download JCE 8 policy from Oracle
I'm needing to download the JCE 8 policy that's normally available on Oracles website, but the last 2 days it seems to be giving me a 404 after accepting their T&C's
https://www.oracle.com/java/...
1
vote
2
answers
461
views
Is the Sunpkcs11 provider compatible with the AWS CloudHSM?
I am trying to work with an HSM (hardware security module) to store keys and to do cryptographic operations. I want to operate the HSM inside a java application. For this I need to use a compatible ...
2
votes
1
answer
2k
views
In decryption using Java Cipher with "AES/CBC/PKCS5Padding", must IV be specified? and only SecretKeyFactory can be used?
I read some examples about using Java Cipher to encrypt and decrypt data. For example:
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
SecureRandom secureRandom = new SecureRandom();
...
1
vote
0
answers
89
views
Does the update() method of the class Cipher have to return encrypted data or data can be buffered internally?
I am implementing a provider for AES for the Cipher class of the JCA (Java Cryptography Architecture).
The class Cipher adopts the init(), update(), doFinal() paradigm. The init() method is called to ...
0
votes
0
answers
538
views
PDFBox throwing exception java.io.IOException: java.security.InvalidKeyException: Illegal key size [duplicate]
I am trying PDFBox for merging multiple PDF documents. Code is below.
I am facing an issue. For a few PDF files I am getting "java.io.IOException: java.security.InvalidKeyException: Illegal key size".
...
0
votes
0
answers
352
views
How to load a keystore from a bytearray in python
In java l use this:
public static KeyStore loadFromByteArray(byte[] keyStoreData, String password) {
KeyStore keyStore = null;
try {
keyStore = KeyStore.getInstance(KEY_KEYSTORE_TYPE)...
1
vote
1
answer
973
views
ClassCastException: com.sun.crypto.provider.AESCipher$General cannot be cast t o javax.crypto.CipherSpi on Karaf 4.2.5
We are using Apache karaf 4.2.5. We are using AES encryption algorithm in our application. And the javax.crypto package is present in the Karaf etc/jre.properties for java 1.8.
We get the ...
2
votes
0
answers
230
views
Is it valid to use the same private key for RootCA and SubCA?
I have created via XCA a PKI where both the Root CA and the Sub CA certs have the same private key. This PKI creates a leaf (end entity) certificate.
I use three different cryptography providers to ...
9
votes
1
answer
5k
views
Jasypt CLI error Operation not possible (Bad input or parameters)
I'm running into an issue identical to Command line Jasypt client encryption 'Operation not possible' however that post is for a much older version of Java.
I've checked the path listed for ...
1
vote
1
answer
207
views
Java AES in CBC and CFB modes not encrypting properly? IV not respected?
I've been doing some learning/experimentation with the basic Java AES stuff, and I can't figure out where I'm doing things wrong. According to the docs, doFinal() should encrypt/decrypt everything in ...
6
votes
2
answers
13k
views
OpenJDK 11 error "Can not initialize cryptographic mechanism"
I have an app written with openJDK (Amazon Correto 11) and openJFX.
When I run the app locally - everything works.
But when I execute the app from network share there is an Exception:
java.lang....
1
vote
1
answer
624
views
Construct x509 encoded public key from algorithm oid and byte[] value of key
I have algorithm oid and byte array with public key value. I need to encode it as asn1 defined in the X.509 standard:
SubjectPublicKeyInfo ::= SEQUENCE {
algorithm AlgorithmIdentifier,
...
2
votes
1
answer
2k
views
Signing with javax.crypto.Cipher vs java.security.Signature
I'm working on some old piece of code that needs to be updated to use another crypto provider. I'm no Java expert. I'm trying to understand what is the difference between signing a hash with javax....
0
votes
0
answers
321
views
Does SSLSocket.startHandshake include certificate verification and hostname verification for SSLSocket?
From the security guide https://developer.android.com/training/articles/security-ssl.html#CommonHostnameProbs, when an SSLSocket is used seperated from the HttpsUrlConnection, hostname verification is ...
0
votes
0
answers
879
views
How to get al alias from hsm by SUNPKCS provider?
I want to get my all key aliases from hsm, but i get this error message :
Exception in thread "main" java.io.IOException: load failed
at sun.security.pkcs11.P11KeyStore.engineLoad(P11KeyStore....
8
votes
1
answer
8k
views
JCE in AdoptOpenJDK 11
Java Cryptography Extension (JCE) can be found here, but that page says
Current versions of the JDK do not require these policy files. They are provided here for use with older version of the JDK.
...
4
votes
1
answer
2k
views
HSM decryption + encryption chaining
My application is acting as a switchboard to transfer very sensitive messages between two parties and I'm trying to figure out how I can do this without "looking" at the message they're trying to send....
1
vote
1
answer
532
views
decrypting p7m with CMS and Luna Hsm on Jboss
I'm decrypting a p7m file trough BouncyCastle api ,backed by Luna HSM. In a single istance all works like a charm.If i deploy the same code in a Jboss in domain mode or two single node i get the ...