< prev index next >
test/jdk/sun/security/pkcs11/ec/TestCurves.java
Print this page
rev 59383 : [mq]: final
*** 1,7 ****
/*
! * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 55,80 ****
if (p.getService("KeyAgreement", "ECDH") == null) {
System.out.println("Not supported by provider, skipping");
return true;
}
! if (isBadNSSVersion(p) || isBadSolarisSparc(p)) {
return true;
}
return false;
}
@Override
public void main(Provider p) throws Exception {
- // Check if this is sparc for later failure avoidance.
- boolean sparc = false;
- if (props.getProperty("os.arch").equals("sparcv9")) {
- sparc = true;
- System.out.println("This is a sparcv9");
- }
-
Random random = new Random();
byte[] data = new byte[2048];
random.nextBytes(data);
List<ECParameterSpec> curves = getKnownCurves(p);
--- 55,73 ----
if (p.getService("KeyAgreement", "ECDH") == null) {
System.out.println("Not supported by provider, skipping");
return true;
}
! if (isBadNSSVersion(p)) {
return true;
}
return false;
}
@Override
public void main(Provider p) throws Exception {
Random random = new Random();
byte[] data = new byte[2048];
random.nextBytes(data);
List<ECParameterSpec> curves = getKnownCurves(p);
*** 86,115 ****
kp1 = kpg.generateKeyPair();
kp2 = kpg.generateKeyPair();
testSigning(p, "SHA1withECDSA", data, kp1, kp2);
- // Check because Solaris ncp driver does not support these but
- // Solaris metaslot causes them to be run.
- try {
testSigning(p, "SHA224withECDSA", data, kp1, kp2);
testSigning(p, "SHA256withECDSA", data, kp1, kp2);
testSigning(p, "SHA384withECDSA", data, kp1, kp2);
testSigning(p, "SHA512withECDSA", data, kp1, kp2);
- } catch (ProviderException e) {
- if (sparc) {
- Throwable t = e.getCause();
- if (t instanceof sun.security.pkcs11.wrapper.PKCS11Exception &&
- t.getMessage().equals("CKR_ATTRIBUTE_VALUE_INVALID")) {
- System.out.print("-Failure not uncommon. Probably pre-T4.");
- } else {
- throw e;
- }
- } else {
- throw e;
- }
- }
System.out.println();
KeyAgreement ka1 = KeyAgreement.getInstance("ECDH", p);
ka1.init(kp1.getPrivate());
ka1.doPhase(kp2.getPublic(), true);
--- 79,92 ----
< prev index next >