1 /* |
1 /* |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 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 6994008 |
26 * @bug 6994008 |
27 * @summary basic test for RSA/ECB/NoPadding cipher |
27 * @summary basic test for RSA/ECB/NoPadding cipher |
28 * @author Valerie Peng |
28 * @author Valerie Peng |
29 * @library .. |
29 * @library .. |
30 * @key randomness |
30 * @key randomness |
|
31 * @run main/othervm TestRawRSACipher |
|
32 * @run main/othervm TestRawRSACipher sm |
31 */ |
33 */ |
32 |
34 |
33 import javax.crypto.*; |
35 import java.security.GeneralSecurityException; |
34 import java.io.*; |
36 import java.security.KeyPair; |
35 import javax.crypto.spec.SecretKeySpec; |
37 import java.security.KeyPairGenerator; |
36 import java.security.*; |
38 import java.security.Provider; |
37 import java.util.*; |
39 import java.util.Arrays; |
|
40 import java.util.Random; |
|
41 import javax.crypto.Cipher; |
38 |
42 |
39 public class TestRawRSACipher extends PKCS11Test { |
43 public class TestRawRSACipher extends PKCS11Test { |
40 |
44 |
|
45 @Override |
41 public void main(Provider p) throws Exception { |
46 public void main(Provider p) throws Exception { |
42 try { |
47 try { |
43 Cipher.getInstance("RSA/ECB/NoPadding", p); |
48 Cipher.getInstance("RSA/ECB/NoPadding", p); |
44 } catch (GeneralSecurityException e) { |
49 } catch (GeneralSecurityException e) { |
45 System.out.println("Not supported by provider, skipping"); |
50 System.out.println("Not supported by provider, skipping"); |