jdk/test/sun/security/pkcs11/SecureRandom/Basic.java
changeset 35379 1e8e336ef66b
parent 30046 cf2c86e1819e
child 40975 680639c9b307
equal deleted inserted replaced
35378:7e19fa0e4e5b 35379:1e8e336ef66b
     1 /*
     1 /*
     2  * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 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.
    26  * @bug 6246411
    26  * @bug 6246411
    27  * @summary basic test for PKCS#11 SecureRandom
    27  * @summary basic test for PKCS#11 SecureRandom
    28  * @author Andreas Sterbenz
    28  * @author Andreas Sterbenz
    29  * @library ..
    29  * @library ..
    30  * @key randomness
    30  * @key randomness
       
    31  * @run main/othervm Basic
       
    32  * @run main/othervm Basic sm
    31  */
    33  */
    32 
    34 
    33 import java.io.*;
    35 import java.security.NoSuchAlgorithmException;
    34 import java.util.*;
    36 import java.security.Provider;
    35 
    37 import java.security.SecureRandom;
    36 import java.security.*;
       
    37 
       
    38 import javax.crypto.*;
       
    39 
    38 
    40 public class Basic extends PKCS11Test {
    39 public class Basic extends PKCS11Test {
    41 
    40 
       
    41     @Override
    42     public void main(Provider p) throws Exception {
    42     public void main(Provider p) throws Exception {
    43         SecureRandom random;
    43         SecureRandom random;
    44         try {
    44         try {
    45             random = SecureRandom.getInstance("PKCS11");
    45             random = SecureRandom.getInstance("PKCS11");
    46         } catch (NoSuchAlgorithmException e) {
    46         } catch (NoSuchAlgorithmException e) {
    56         System.out.println(toString(b));
    56         System.out.println(toString(b));
    57         System.out.println("OK");
    57         System.out.println("OK");
    58     }
    58     }
    59 
    59 
    60     public static void main(String[] args) throws Exception {
    60     public static void main(String[] args) throws Exception {
    61         main(new Basic());
    61         main(new Basic(), args);
    62     }
    62     }
    63 
    63 
    64 }
    64 }