--- a/jdk/test/sun/security/pkcs11/Secmod/Crypto.java Tue Jan 26 09:25:53 2016 +0000
+++ b/jdk/test/sun/security/pkcs11/Secmod/Crypto.java Tue Jan 26 13:32:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -28,9 +28,14 @@
* @author Andreas Sterbenz
* @library ..
* @run main/othervm Crypto
+ * @run main/othervm Crypto sm policy
*/
-import java.security.*;
+import java.io.File;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.Provider;
+import java.security.Signature;
public class Crypto extends SecmodTest {
@@ -42,6 +47,12 @@
String configName = BASE + SEP + "nsscrypto.cfg";
Provider p = getSunPKCS11(configName);
+ if (args.length > 1 && "sm".equals(args[0])) {
+ System.setProperty("java.security.policy",
+ BASE + File.separator + args[1]);
+ System.setSecurityManager(new SecurityManager());
+ }
+
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p);
KeyPair kp = kpg.generateKeyPair();