Questions tagged [jce]

Java Cryptographic Extension : a pluggable cryptography framework where various providers can bring the desired functionality

Part of the Java Cryptographic Architecture. The JCA is comprised of one API part and providers. Providers shipped with the JRE may not have implementation for all features permitted by the API e.g. Sun's provider missing the RC5 algorithm, in which case one can turn to external providers like Bouncycastle to get the desired functionality.

432 questions
301
votes
6 answers

Trust Store vs Key Store - creating with keytool

I understand that the keystore would usually hold private/public keys and the trust store only public keys (and represents the list of trusted parties you intend to communicate with). Well, that's my first assumption, so if that's not correct, I…
Toby
  • 9,523
  • 8
  • 36
  • 59
174
votes
11 answers

How to avoid installing "Unlimited Strength" JCE policy files when deploying an application?

I have an app that uses 256-bit AES encryption which is not supported by Java out of the box. I know to get this to function correctly I install the JCE unlimited strength jars in the security folder. This is fine for me being the developer, I can…
Ken
120
votes
9 answers

Hash String via SHA-256 in Java

By looking around here as well as the internet in general, I have found Bouncy Castle. I want to use Bouncy Castle (or some other freely available utility) to generate a SHA-256 Hash of a String in Java. Looking at their documentation I can't seem…
knpwrs
  • 15,691
  • 12
  • 62
  • 103
87
votes
5 answers

Why java.security.NoSuchProviderException No such provider: BC?

The jar (bcprov-jdk16-145.jar) has been added to the project, Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()) has been added to the class, and BouncyCastleProvider.PROVIDER_NAME does return "BC" but…
jacknad
  • 13,483
  • 40
  • 124
  • 194
64
votes
6 answers

InvalidKeyException Illegal key size

I have a test which runs great on my development MacBook Pro, but fails to run in continuous integration TeamCity server. The error is following: java.security.InvalidKeyException: Illegal key size at javax.crypto.Cipher.a(DashoA13*..) at…
Vladimir
  • 4,782
  • 7
  • 35
  • 56
63
votes
8 answers

How to install unlimited strength JCE for Java 8 in OS X?

I need to install the Java Cryptography Extension for Java 8 in OS X / mac OS. It turns out the steps from the README file which came with the installer include instructions only for Unix and Windows, but not for OS X / mac OS. I tried to put the…
JonDoe297
  • 1,601
  • 1
  • 15
  • 21
63
votes
3 answers

How to create a secure random AES key in Java?

What is the recommended way of generating a secure, random AES key in Java, using the standard JDK? In other posts, I have found this, but using a SecretKeyFactory might be a better idea: KeyGenerator keyGen =…
barfuin
  • 16,865
  • 10
  • 85
  • 132
49
votes
9 answers

Checking if Unlimited Cryptography is available

How can I check, in Java code, if the current JVM have unlimited strength cryptography available?
Chi-Lan
  • 3,575
  • 3
  • 22
  • 24
47
votes
5 answers

Creating an X509 Certificate in Java without BouncyCastle?

Is it possible to sanely create an X509 Certificate in Java code without using the Bouncy Castle X509V*CertificateGenerator classes?
Yuliy
  • 17,381
  • 6
  • 41
  • 47
44
votes
1 answer

Check for JCE Unlimited Strength Jurisdiction Policy files

I am usure if the JCE Unlimited Strength Jurisdiction Policy files have been installed correctly in the JVM (because some other part of the system behaves as if they weren't). Can someone supply a code sample that I can use to check if those files…
B.E.
  • 5,080
  • 4
  • 35
  • 43
42
votes
1 answer

How to convert Byte array to PrivateKey or PublicKey type?

I am using RSA algorithm to generate public and private key final KeyPairGenerator keyGen = KeyPairGenerator.getInstance(ALGORITHM); keyGen.initialize(1024); final KeyPair key = keyGen.generateKeyPair(); final PrivateKey…
sufala
  • 553
  • 4
  • 11
  • 19
41
votes
3 answers

PBKDF2 with bouncycastle in Java

I'm trying to securely store a password in a database and for that I chose to store its hash generated using the PBKDF2 function. I want to do this using the bouncy castle library but I don't know why I cannot get it to work by using the JCE…
andrei.serea
  • 950
  • 1
  • 9
  • 15
39
votes
3 answers

How to install unlimited strength JCE for JRE 7 in MacOSX?

I installed Oracle JRE 7 (not JDK) for MacOSX but I can't locate where the JCE jurisdiction files are placed. I need to replace them with the unlimited strength version.
Andrea Mariottini
  • 441
  • 1
  • 5
  • 6
39
votes
5 answers

java.security.NoSuchAlgorithmException:Cannot find any provider supporting AES/ECB/PKCS7PADDING

I was trying to encrypt data using AES algorithm. However, with the following exception has occurred. java.security.NoSuchAlgorithmException: Cannot find any provider supporting AES/ECB/PKCS7PADDING Someone know a solution to this issue? My…
Suby Lee
  • 415
  • 1
  • 4
  • 6
36
votes
3 answers

Why are the JCE Unlimited Strength not included by default?

Setup Java doesn't offer out-of-the-box support for the JCE Unlimited Strength Policy Files This prevents users from using AES-256, the largest key size of a widely-used encryption standard Not including the policy files leads to many…
dminuoso
  • 963
  • 1
  • 7
  • 10
1
2 3
28 29