jdk/test/sun/security/pkcs11/ec/ReadCertificates.java
changeset 13661 7c894680910a
parent 10328 06c93c42bca0
child 14342 8435a30053c1
equal deleted inserted replaced
13659:18f4e55bb34b 13661:7c894680910a
    61     public void main(Provider p) throws Exception {
    61     public void main(Provider p) throws Exception {
    62         if (p.getService("Signature", "SHA1withECDSA") == null) {
    62         if (p.getService("Signature", "SHA1withECDSA") == null) {
    63             System.out.println("Provider does not support ECDSA, skipping...");
    63             System.out.println("Provider does not support ECDSA, skipping...");
    64             return;
    64             return;
    65         }
    65         }
       
    66 
       
    67         /*
       
    68          * PKCS11Test.main will remove this provider if needed
       
    69          */
    66         Providers.setAt(p, 1);
    70         Providers.setAt(p, 1);
    67 
    71 
    68         random = new SecureRandom();
    72         random = new SecureRandom();
    69         factory = CertificateFactory.getInstance("X.509");
    73         factory = CertificateFactory.getInstance("X.509");
    70         try {
    74         try {
   130             } catch (InvalidKeyException e) {
   134             } catch (InvalidKeyException e) {
   131                 System.out.println("OK: " + e);
   135                 System.out.println("OK: " + e);
   132             }
   136             }
   133         }
   137         }
   134 
   138 
   135         Security.removeProvider(p.getName());
       
   136         System.out.println("OK");
   139         System.out.println("OK");
   137     }
   140     }
   138 
   141 
   139     private static X509Certificate getRandomCert(List<X509Certificate> certs) {
   142     private static X509Certificate getRandomCert(List<X509Certificate> certs) {
   140         int n = random.nextInt(certs.size());
   143         int n = random.nextInt(certs.size());