jce

Oracle JDK installs two JREs?

拟墨画扇 提交于 2019-12-04 07:26:02
Before downvoting or close-requesting this question please see that this question is about JDK 7 not 6, it has a second question 'Q2' which is not addressed by any duplicate thread and this question is about four not only two java.exe instances. Thank you! I've just installed Oracle's Java SE JDK (64 bit) which resulted in the following directory layout, and somehow two JREs: C:\Program Files\Java\ \jdk1.7.0_40 \jre \jre7 I'm now the proud owner of four java.exe executables: C:\Program Files\Java\jdk1.7.0_40\bin\java.exe C:\Program Files\Java\jdk1.7.0_40\jre\bin\java.exe C:\Program Files\Java

JCE Unlimited Strength installed but AES 256 is not supported

百般思念 提交于 2019-12-03 23:09:33
I have installed JCE Unlimited strength to JAVA_HOME\lib\security However, I'm still getting 128 for Cipher.getMaxAllowedKeyLength("AES") . I'm wondering if I have installed the JCE at the wrong place. I have Java installed in 2 places. C:\Program Files\Java\jre7 C:\Development\Java\jdk1.6.0_21 Can anyone tell me where is the correct place to install JCE Unlimited strength? Your help is much appreciated. my code: KeyGenerator generator = KeyGenerator.getInstance("AES"); generator.init(256); SecretKey secretKey = generator.generateKey(); byte[] raw= secretKey.getEncoded(); SecretKeySpec sskey=

IllegalBlockSize Exception When Doing RSA on bytes of Strings

旧时模样 提交于 2019-12-03 21:54:32
I am trying to write RSA encryption and decryption classes in Java for a server where the client will be passing strings back and forth. I have the following code for the classes: public class RSAEncryption { public static final String KEYGENALGORITHM = "RSA"; public static final String ALGORITHM = "RSA/ECB/PKCS1Padding"; public static KeyPairContainer generateKey() { KeyPairGenerator keyGen; KeyPair key; try { keyGen = KeyPairGenerator.getInstance(KEYGENALGORITHM); keyGen.initialize(1024); key = keyGen.generateKeyPair(); return new KeyPairContainer(key.getPublic(), key.getPrivate()); } catch

Configure Oracle JDK to use IBM JCE/JSSE providers for FIPS compliance

我们两清 提交于 2019-12-03 13:53:11
问题 I would like to configure the Oracle JDK to use IBM's FIPS-compliant JCE/JSSE security providers. What JAR files do I need and where should they be installed? What should the provider list in the java.security file look like? 回答1: I'm using IBMJCE on sun jdk5 and it works fine. It may be similar to fips, I guess You need ibmjceprovider.jar, ibmpkcs.jar, ibmjcefips.jar You can find them in ibm jre The code like this static{ //install ibm's provider java.security.Security.addProvider(new IBMJCE

What's wrong with IBM's JCE provider?

寵の児 提交于 2019-12-03 07:54:47
问题 I have a JCE test that works fine with all Sun JDKs I have tried, but fails with various IBM J9 JDKs (e.g. 1.6.0 build pwi3260sr8-20100409_01(SR8)). The exception below happens when the cipher is initialized in encrypt mode. Why can the IBM JCE not use its own private key? Am I missing something in my code? public void testBasicKeyGeneration() throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchProviderException,

Configure Oracle JDK to use IBM JCE/JSSE providers for FIPS compliance

不羁的心 提交于 2019-12-03 04:53:17
I would like to configure the Oracle JDK to use IBM's FIPS-compliant JCE/JSSE security providers. What JAR files do I need and where should they be installed? What should the provider list in the java.security file look like? kyon I'm using IBMJCE on sun jdk5 and it works fine. It may be similar to fips, I guess You need ibmjceprovider.jar, ibmpkcs.jar, ibmjcefips.jar You can find them in ibm jre The code like this static{ //install ibm's provider java.security.Security.addProvider(new IBMJCE()); } public byte[] encrypt(byte[] input)throws SecurityException{ KeyGenerator kg = KeyGenerator

Reading pkcs12 certificate information

别说谁变了你拦得住时间么 提交于 2019-12-03 04:30:38
问题 I have a problem with reading certificate information. I want to read full information using java with bouncycastle library in Android programmatically. Now, i'm just using keytool command in console: >keytool -list -keystore 1.p12 -storetype pkcs12 -v Any suggestions? 回答1: I've found solution, the main idea is to cast certificate to x509, then get the SubjectDN and parse values. public class TestClass { public static void main(String[] args) throws Exception { KeyStore p12 = KeyStore

AES/CBC/PKCS5Padding issue

 ̄綄美尐妖づ 提交于 2019-12-03 04:00:28
I am trying to encrypt and decrypt some simple text. But for some reason I am getting a strange error: javax.crypto.BadPaddingException . Why would JCE generates bytes that are not properly padded? I have the following code: import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import java.security.SecureRandom; public class SimplestTest { public static void main(String[] args) throws Exception { SecureRandom rnd = new SecureRandom(); String text = "Hello, my dear! ... " + System.getProperty("user.home"); byte[]

Dazed and confused by Java Security & BouncyCastle APIs

不羁的心 提交于 2019-12-03 03:58:57
问题 I've been trying to make sense of the BouncyCastle cryptography APIs for Java. Unfortunately, I'm finding Java cryptography in general to be so obscured by service provider interfaces and jargon that I can't wrap my head around what anything actually does. I've tried reading the necessary documentation repeatedly but it just stays incomprehensible, introducing many concepts far beyond what I think should be needed. All I really want is a class that does the following: public class KeyPair {

Exception when decrypting a “der” file generated with OpenSSL: Input length must be multiple of 8 when decrypting with padded cipher

怎甘沉沦 提交于 2019-12-02 22:57:43
问题 first I generate a private RSA keyfile with OpenSSL and then convert it into an encrypted "der" file: $ openssl pkcs8 -topk8 -inform PEM -outform DER -in private_key.pem -out private_key.der Next I try to decrypt this file from Java using the following code(at this stage I already read the file into the byte[] key array using code that is at the bottom of this post): public static byte[] decryptPrivateKey(byte[] key) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException,