jdk/test/sun/security/pkcs11/Signature/TestRSAKeyLength.java
changeset 35379 1e8e336ef66b
parent 32138 23830562d3d1
child 40975 680639c9b307
equal deleted inserted replaced
35378:7e19fa0e4e5b 35379:1e8e336ef66b
     1 /*
     1 /*
     2  * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    25  * @test %W% %E%
    25  * @test %W% %E%
    26  * @bug 6695485
    26  * @bug 6695485
    27  * @summary Make sure initSign/initVerify() check RSA key lengths
    27  * @summary Make sure initSign/initVerify() check RSA key lengths
    28  * @author Yu-Ching Valerie Peng
    28  * @author Yu-Ching Valerie Peng
    29  * @library ..
    29  * @library ..
       
    30  * @run main/othervm TestRSAKeyLength
       
    31  * @run main/othervm TestRSAKeyLength sm
    30  */
    32  */
    31 
    33 
    32 import java.security.*;
    34 import java.security.InvalidKeyException;
       
    35 import java.security.KeyPair;
       
    36 import java.security.KeyPairGenerator;
       
    37 import java.security.PrivateKey;
       
    38 import java.security.Provider;
       
    39 import java.security.PublicKey;
       
    40 import java.security.Signature;
       
    41 import java.security.SignedObject;
    33 
    42 
    34 public class TestRSAKeyLength extends PKCS11Test {
    43 public class TestRSAKeyLength extends PKCS11Test {
       
    44 
    35     public static void main(String[] args) throws Exception {
    45     public static void main(String[] args) throws Exception {
    36         main(new TestRSAKeyLength());
    46         main(new TestRSAKeyLength(), args);
    37     }
    47     }
       
    48 
       
    49     @Override
    38     public void main(Provider p) throws Exception {
    50     public void main(Provider p) throws Exception {
    39 
    51 
    40         /*
    52         /*
    41          * Use Solaris SPARC 11.2 or later to avoid an intermittent failure
    53          * Use Solaris SPARC 11.2 or later to avoid an intermittent failure
    42          * when running SunPKCS11-Solaris (8044554)
    54          * when running SunPKCS11-Solaris (8044554)
    43          */
    55          */
    44         if (p.getName().equals("SunPKCS11-Solaris") &&
    56         if (p.getName().equals("SunPKCS11-Solaris") &&
    45             System.getProperty("os.name").equals("SunOS") &&
    57             props.getProperty("os.name").equals("SunOS") &&
    46             System.getProperty("os.arch").equals("sparcv9") &&
    58             props.getProperty("os.arch").equals("sparcv9") &&
    47             System.getProperty("os.version").compareTo("5.11") <= 0 &&
    59             props.getProperty("os.version").compareTo("5.11") <= 0 &&
    48             getDistro().compareTo("11.2") < 0) {
    60             getDistro().compareTo("11.2") < 0) {
    49 
    61 
    50             System.out.println("SunPKCS11-Solaris provider requires " +
    62             System.out.println("SunPKCS11-Solaris provider requires " +
    51                 "Solaris SPARC 11.2 or later, skipping");
    63                 "Solaris SPARC 11.2 or later, skipping");
    52             return;
    64             return;