From a4223b53c16aa70cc7894f3ecb9732f4346ebd12 Mon Sep 17 00:00:00 2001 From: Valerie Peng Date: Thu, 11 Jul 2013 11:43:23 -0700 Subject: [PATCH] 8020321: Problem in PKCS11 regression test TestRSAKeyLength Corrected the "isValidKeyLength" array Reviewed-by: xuelei --- .../sun/security/pkcs11/Signature/TestRSAKeyLength.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java b/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java index 81309213b35..9d6f62a8a1c 100644 --- a/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java +++ b/jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, 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 @@ -36,7 +36,7 @@ public class TestRSAKeyLength extends PKCS11Test { main(new TestRSAKeyLength()); } public void main(Provider p) throws Exception { - boolean isValidKeyLength[] = { true, true, false, false }; + boolean isValidKeyLength[] = { true, true, true, false, false }; String algos[] = { "SHA1withRSA", "SHA224withRSA", "SHA256withRSA", "SHA384withRSA", "SHA512withRSA" }; KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); @@ -45,6 +45,10 @@ public class TestRSAKeyLength extends PKCS11Test { PrivateKey privKey = kp.getPrivate(); PublicKey pubKey = kp.getPublic(); + if (algos.length != isValidKeyLength.length) { + throw new Exception("Internal Error: number of test algos" + + " and results length mismatch!"); + } for (int i = 0; i < algos.length; i++) { Signature sig = Signature.getInstance(algos[i], p); System.out.println("Testing RSA signature " + algos[i]);