/[classpath]/classpath/java/security/Security.java
ViewVC logotype

Diff of /classpath/java/security/Security.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by mark, Sun Aug 18 16:17:28 2002 UTC revision 1.11 by mark, Sat Nov 16 23:28:25 2002 UTC
# Line 1  Line 1 
1  /* Security.java --- Java base security class implmentation  /* Security.java --- Java base security class implmentation
2     Copyright (C) 1999, 2001 Free Software Foundation, Inc.     Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 127  public final class Security extends Obje Line 127  public final class Security extends Obje
127    }    }
128    
129    /**    /**
130       Gets a specific property for an algorithm. This is used to produce specialized       Gets a specific property for an algorithm. This is used to produce
131       algorithm parsers.       specialized algorithm parsers.
132    
133       @deprecated it used to a return the value of a propietary property       @deprecated it used to a return the value of a propietary property
134       for the "SUN" Cryptographic Service Provider to obtain       for the "SUN" Cryptographic Service Provider to obtain
# Line 147  public final class Security extends Obje Line 147  public final class Security extends Obje
147    }    }
148    
149    /**    /**
150       Adds a new provider at the specified position. This allows dynamic loading       Adds a new provider, at a specified position. The position is the
151       of providers. It will check for duplication of providers.       preference order in which providers are searched for requested algorithms.
152         Note that it is not guaranteed that this preference will be respected. The
153       This class checks the security manager with the call checkSecurityAccess       position is 1-based, that is, 1 is most preferred, followed by 2, and so
154       with "insertProvider."+provider.getName() to see if the user can add this       on.
155       provider.       <p>
156         If the given provider is installed at the requested position, the
157       @param provider the provider to add       provider that used to be at that position, and all providers with a
158       @param position position to add the provider at       position greater than position, are shifted up one position (towards the
159         end of the list of installed providers).
160       @return the position the provider was added at, or -1 if a duplicate provider       <p>
161       was found       A provider cannot be added if it is already installed.
162         <p>
163       @throws SecurityException - if the security manager denies access to add a       <b>NOT IMPLEMENTED YET:</b>[
164       new provider       First, if there is a security manager, its <code>checkSecurityAccess</code>
165         method is called with the string
166         <code>"insertProvider."+provider.getName()</code>
167         to see if it's ok to add a new provider. If the default implementation of
168         <code>checkSecurityAccess</code> is used (i.e., that method is not
169         overriden), then this will result in a call to the security manager's
170         <code>checkPermission</code> method with a <code>SecurityPermission(
171         "insertProvider."+provider.getName())</code> permission.]
172    
173         @param provider the provider to be added.
174         @param position the preference position that the caller would like for
175         this provider.
176         @return the actual preference position (1-based) in which the provider was
177         added, or -1 if the provider was not added because it is already installed.
178         @throws SecurityException if a security manager exists and its <code>
179         SecurityManager.checkSecurityAccess(java.lang.String)</code> method denies
180         access to add a new provider.
181     */     */
182    public static int insertProviderAt(Provider provider, int position)    public static int insertProviderAt(Provider provider, int position)
183    {    {
# Line 169  public final class Security extends Obje Line 185  public final class Security extends Obje
185      if (sm != null)      if (sm != null)
186        sm.checkSecurityAccess("insertProvider." + provider.getName());        sm.checkSecurityAccess("insertProvider." + provider.getName());
187    
188        position--;
189      int max = providers.size ();      int max = providers.size ();
190      for (int i = 0; i < max; i++)      for (int i = 0; i < max; i++)
191        {        {
# Line 184  public final class Security extends Obje Line 201  public final class Security extends Obje
201    
202      providers.insertElementAt(provider, position);      providers.insertElementAt(provider, position);
203    
204      return position;      return position + 1;
205    }    }
206    
207    
208    /**    /**
209       Adds a new provider. This allows dynamic loading       Adds a provider to the next position available.
210       of providers. It will check for duplication of providers.       <p>
211         <b>NOT IMPLEMENTED YET:</b> [
212       This method checks the security manager with the call checkSecurityAccess       First, if there is a security manager, its <code>checkSecurityAccess</code>
213       with "insertProvider."+provider.getName() to see if the user can add this       method is called with the string
214       provider.       <code>"insertProvider."+provider.getName()</code>
215         to see if it's ok to add a new provider. If the default implementation of
216       @param provider the provider to add       <code>checkSecurityAccess</code> is used (i.e., that method is not
217         overriden), then this will result in a call to the security manager's
218       @return the position the provider was added at, or -1 if a duplicate provider       <code>checkPermission</code> method with a <code>SecurityPermission(
219       was found       "insertProvider."+provider.getName())</code> permission.]
220    
221       @throws SecurityException - if the security manager denies access to add a       @param provider the provider to be added.
222       new provider       @return the preference position in which the provider was added, or <code>
223         -1</code> if the provider was not added because it is already installed.
224         @throws SecurityException if a security manager exists and its <code>
225         SecurityManager.checkSecurityAccess(java.lang.String)</code> method denies
226         access to add a new provider.
227     */     */
228    public static int addProvider(Provider provider)    public static int addProvider(Provider provider)
229    {    {
230      return insertProviderAt (provider, providers.size ());      return insertProviderAt (provider, providers.size () + 1);
231    }    }
232    
233    /**    /**
# Line 215  public final class Security extends Obje Line 236  public final class Security extends Obje
236       ranking. If the provider is not installed, it fails silently.       ranking. If the provider is not installed, it fails silently.
237    
238       This method checks the security manager with the call checkSecurityAccess       This method checks the security manager with the call checkSecurityAccess
239       with "removeProvider."+provider.getName() to see if the user can remove this       with "removeProvider."+provider.getName() to see if the user can remove
240       provider.       this provider.
241    
242       @param name name of the provider to add       @param name name of the provider to add
243    
244       @throws SecurityException - if the security manager denies access to remove a       @throws SecurityException - if the security manager denies access to
245       new provider       remove a new provider
246     */     */
247    public static void removeProvider(String name)    public static void removeProvider(String name)
248    {    {

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26