1 /* 2 * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.net.ssl; 27 28 import java.security; 29 import java.util.Enumeration; 30 import java.util.Hashtable; 31 import java.util.StringTokenizer; 32 import java.security.Permissions; 33 import java.lang.SecurityManager; 34 35 /** 36 * This class is for various network permissions. 37 * An SSLPermission contains a name (also referred to as a "target name") but 38 * no actions list; you either have the named permission 39 * or you don't. 40 * <P> 41 * The target name is the name of the network permission (see below). The naming 42 * convention follows the hierarchical property naming convention. 43 * Also, an asterisk 44 * may appear at the end of the name, following a ".", or by itself, to 45 * signify a wildcard match. For example: "foo.*" or "*" is valid, 46 * "*foo" or "a*b" is not valid. 47 * <P> 48 * The following table lists all the possible SSLPermission target names, 49 * and for each provides a description of what the permission allows 50 * and a discussion of the risks of granting code the permission. 51 * <P> 52 * 53 * <table border=1 cellpadding=5 54 * summary="permission name, what it allows, and associated risks"> 55 * <tr> 56 * <th>Permission Target Name</th> 57 * <th>What the Permission Allows</th> 58 * <th>Risks of Allowing this Permission</th> 59 * </tr> 60 * 61 * <tr> 62 * <td>setHostnameVerifier</td> 63 * <td>The ability to set a callback which can decide whether to 64 * allow a mismatch between the host being connected to by 65 * an HttpsURLConnection and the common name field in 66 * server certificate. 67 * </td> 68 * <td>Malicious 69 * code can set a verifier that monitors host names visited by 70 * HttpsURLConnection requests or that allows server certificates 71 * with invalid common names. 72 * </td> 73 * </tr> 74 * 75 * <tr> 76 * <td>getSSLSessionContext</td> 77 * <td>The ability to get the SSLSessionContext of an SSLSession. 78 * </td> 79 * <td>Malicious code may monitor sessions which have been established 80 * with SSL peers or might invalidate sessions to slow down performance. 81 * </td> 82 * </tr> 83 * 84 * <tr> 85 * <td>setDefaultSSLContext</td> 86 * <td>The ability to set the default SSL context 87 * </td> 88 * <td>Malicious code can set a context that monitors the opening of 89 * connections or the plaintext data that is transmitted. 90 * </td> 91 * </tr> 92 * 93 * </table> 94 * 95 * @see java.security.BasicPermission 96 * @see java.security.Permission 97 * @see java.security.Permissions 98 * @see java.security.PermissionCollection 99 * @see java.lang.SecurityManager 100 * 101 * @since 1.4 102 * @author Marianne Mueller 103 * @author Roland Schemers 104 */ 105 106 public final class SSLPermission extends BasicPermission { 107 108 private static final long serialVersionUID = -3456898025505876775L; 109 110 /** 111 * Creates a new SSLPermission with the specified name. 112 * The name is the symbolic name of the SSLPermission, such as 113 * "setDefaultAuthenticator", etc. An asterisk 114 * may appear at the end of the name, following a ".", or by itself, to 115 * signify a wildcard match. 116 * 117 * @param name the name of the SSLPermission. 118 * 119 * @throws NullPointerException if <code>name</code> is null. 120 * @throws IllegalArgumentException if <code>name</code> is empty. 121 */ 122 123 public SSLPermission(String name) 124 { 125 super(name); 126 } 127 128 /** 129 * Creates a new SSLPermission object with the specified name. 130 * The name is the symbolic name of the SSLPermission, and the 131 * actions String is currently unused and should be null. 132 * 133 * @param name the name of the SSLPermission. 134 * @param actions ignored. 135 * 136 * @throws NullPointerException if <code>name</code> is null. 137 * @throws IllegalArgumentException if <code>name</code> is empty. 138 */ 139 140 public SSLPermission(String name, String actions) 141 { 142 super(name, actions); 143 } 144 }