use of javax.crypto.spec.GCMParameterSpec in project jdk8u_jdk by JetBrains.
the class GCMParameterSpecTest method newGCMParameterSpecFail.
private static void newGCMParameterSpecFail(int tLen, byte[] src, int offset, int len) {
try {
new GCMParameterSpec(tLen, src, offset, len);
new Exception("Didn't Fail as Expected").printStackTrace();
failed++;
} catch (IllegalArgumentException e) {
// swallow
}
}
use of javax.crypto.spec.GCMParameterSpec in project jdk8u_jdk by JetBrains.
the class GCMParameterSpecTest method newGCMParameterSpecPass.
private static void newGCMParameterSpecPass(int tLen, byte[] src, int offset, int len) {
try {
GCMParameterSpec gcmps = new GCMParameterSpec(tLen, src, offset, len);
if (gcmps.getTLen() != tLen) {
throw new Exception("tLen's not equal");
}
if (!Arrays.equals(gcmps.getIV(), Arrays.copyOfRange(src, offset, offset + len))) {
System.out.println(offset + " " + len);
System.out.println(Arrays.copyOfRange(src, offset, len)[0]);
throw new Exception("IV's not equal");
}
} catch (Exception e) {
e.printStackTrace();
failed++;
}
}
Aggregations