Skip to content

Commit

Permalink
Update CryptoTest.java to load CipherCore
Browse files Browse the repository at this point in the history
MessageDigest openssl support is being disabled due to eclipse-openj9#4530, the test
needs to check a different algorithm.

ibmruntimes/openj9-openjdk-jdk11#117
ibmruntimes/openj9-openjdk-jdk8#259

[ci skip]

Signed-off-by: Peter Shipton <Peter_Shipton@ca.ibm.com>
  • Loading branch information
pshipton committed Feb 3, 2019
1 parent 8f9b7a7 commit e0e3bc8
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@

package org.openj9.test.openssl;

import java.security.KeyFactory;
import java.util.Random;
import java.security.spec.AlgorithmParameterSpec;

import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

public class CryptoTest {
public static void main(String[] args) {
try {
KeyFactory.getInstance("RSA");
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
Random r = new Random(10);
byte[] skey_bytes = new byte[16];
r.nextBytes(skey_bytes);
SecretKeySpec skey = new SecretKeySpec(skey_bytes, "AES");
cipher.init(Cipher.ENCRYPT_MODE, skey);
System.out.println("Crypto test COMPLETED");
} catch (Exception e) {
System.out.println("Crypto test FAILED");
Expand Down

0 comments on commit e0e3bc8

Please sign in to comment.