Integrate work by Raif S.

Integrate work by Raif S. Naffah (raif@fl.net.au)
	* java/security/DummyKeyPairGenerator.java (clone): New method.
	* java/security/DummyMessageDigest.java (clone): New method.
	(engineUpdate): Now public.
	(engineReset): Likewise.
	(engineDigest): Likewise.
	(engineGetDigestLength): New method.
	* java/security/DummySignature.java (clone): New method.
	* java/security/KeyPairGenerator.java (provider): Now package private.
	(getInstance(String)): Use getInstance(String,Provider).
	(getInstance(String,String): Use getInstance(String,Provider)
	(getInstance(String,Provider): New method.
	(getInstance(String,String,Provider): Don't cast DummyKeyPairGenerator.
	* java/security/KeyPairGeneratorSpi.java (clone): New method.
	* java/security/MessageDigest.java (provider): Now package private.
	(getInstance(String): Use getInstance(String,Provider).
	(getInstance(String,String): Use getInstance(String,Provider)
	(getInstance(String,Provider): New method.
	* java/security/Provider.java (toCanonicalKey): New method.
	(get): New method that uses toCanonicalKey().
	(put): Use toCanonicalKey().
	(remove): Likewise.
	* java/security/Security.java (insertProviderAt): Provider index is one
	based, not zero based.
	(addProvider): Likewise.
	(removeProvider): Likewise.
	* java/security/Signature.java (provider): Now package private.
	(getInstance(String)): Use getInstance(String,Provider).
	(getInstance(String,String): Use getInstance(String,Provider)
	(getInstance(String,Provider): New method.
	(getInstance(String,String,Provider): Don't cast DummySignature.

From-SVN: r59179
This commit is contained in:
Mark Wielaard
2002-11-17 00:10:24 +00:00
committed by Mark Wielaard
parent aaefd21647
commit b0fc58713d
10 changed files with 349 additions and 116 deletions
+41 -8
View File
@@ -1,5 +1,5 @@
/* Provider.java -- Security provider information
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -119,16 +119,40 @@ public abstract class Provider extends Properties implements Serializable
}
/**
* This method sets the specified key to have the specified value.
* Sets the key property to have the specified value.
* <p>
* <bold>NOT IMPLEMENTED YET</bold>[
* First, if there is a security manager, its <code>checkSecurityAccess</code>
* method is called with the string "putProviderProperty."+name, where name is
* the provider name, to see if it's ok to set this provider's property
* values.
* If the default implementation of <code>checkSecurityAccess</code> is used
* (that is, that method is not overriden), then this results in a call to the
* security manager's <code>checkPermission</code> method with a
* <code>SecurityPermission("putProviderProperty."+name)</code>
* permission.<br>]
*
* @param key The property key
* @param value The property value
* @param key The property key.
* @param value The property value.
*
* @return The previous value for this key, or <code>null</code> if no previous value.
* @return The previous value of the specified property (<code>key</code>),
* or <code>null</code> if it did not have one.
* @throws SecurityException If a security manager exists and its
* {@link java.lang.SecurityManager.checkSecurityAccess(java.lang.String)}
* method denies access to set property values.
* @since Classpath 0.4+cvs, JDK 1.2
* @see java.lang.Object.equals(Object)
* @see java.util.Hashtable.get(Object)
*/
public Object put(Object key, Object value)
{
return (super.put(key, value));
return super.put(toCanonicalKey(key), value);
}
// overrides same in java.util.Hashtable
public Object get(Object key)
{
return super.get(toCanonicalKey(key));
}
/**
@@ -137,11 +161,12 @@ public abstract class Provider extends Properties implements Serializable
*
* @param key The key to remove
*
* @return The previous value for this key, or <code>null</code> if no previous value.
* @return The previous value for this key, or <code>null</code> if no
* previous value.
*/
public Object remove(Object key)
{
return (super.remove(key));
return super.remove(toCanonicalKey(key));
}
/**
@@ -166,4 +191,12 @@ public abstract class Provider extends Properties implements Serializable
return (getClass().getName() + ": name=" + getName() + " version=" +
version);
}
private Object toCanonicalKey(Object key)
{
if (key.getClass().isAssignableFrom(String.class)) // is it ours?
return ((String) key).toUpperCase(); // use default locale
else
return key;
}
}