Commit 2f9e468e authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Update libcore/security to Harmony r823222.

Squashed commit of the following:

commit e3083dde77b71fa817c8a52d9edafcb6325cfc25
Author: Elliott Hughes <enh@google.com>
Date:   Fri Oct 9 13:10:11 2009 -0700

    security_dalvik

commit 0fc0101e5dbfb3e3044702579ab8087a4e07984a
Author: Elliott Hughes <enh@google.com>
Date:   Fri Oct 9 13:09:48 2009 -0700

    security_527399
parent cb570246
...@@ -15,15 +15,6 @@ ...@@ -15,15 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Alexander V. Astapchuk
* @version $Revision$
*/
// BEGIN android-note
// Added Deprecated annotation.
// END android-note
package java.security; package java.security;
import java.io.Serializable; import java.io.Serializable;
...@@ -34,11 +25,10 @@ import org.apache.harmony.security.internal.nls.Messages; ...@@ -34,11 +25,10 @@ import org.apache.harmony.security.internal.nls.Messages;
/** /**
* {@code Identity} represents an identity like a person or a company. * {@code Identity} represents an identity like a person or a company.
* *
* @deprecated The functionality of this class has been replace by * @deprecated The functionality of this class has been replace by
* {@link Principal}, {@link KeyStore} and the {@code * {@link Principal}, {@link KeyStore} and the {@code
* java.security.cert} package. * java.security.cert} package.
* @since Android 1.0
*/ */
@Deprecated @Deprecated
public abstract class Identity implements Principal, Serializable { public abstract class Identity implements Principal, Serializable {
...@@ -56,18 +46,15 @@ public abstract class Identity implements Principal, Serializable { ...@@ -56,18 +46,15 @@ public abstract class Identity implements Principal, Serializable {
/** /**
* Constructs a new instance of {@code Identity}. * Constructs a new instance of {@code Identity}.
*
* @since Android 1.0
*/ */
protected Identity() { protected Identity() {
} }
/** /**
* Creates a new instance of {@code Identity} with the specified name. * Creates a new instance of {@code Identity} with the specified name.
* *
* @param name * @param name
* the name of this {@code Identity}. * the name of this {@code Identity}.
* @since Android 1.0
*/ */
public Identity(String name) { public Identity(String name) {
this.name = name; this.name = name;
...@@ -76,7 +63,7 @@ public abstract class Identity implements Principal, Serializable { ...@@ -76,7 +63,7 @@ public abstract class Identity implements Principal, Serializable {
/** /**
* Creates a new instance of {@code Identity} with the specified name and * Creates a new instance of {@code Identity} with the specified name and
* the scope of this {@code Identity}. * the scope of this {@code Identity}.
* *
* @param name * @param name
* the name of this {@code Identity}. * the name of this {@code Identity}.
* @param scope * @param scope
...@@ -84,7 +71,6 @@ public abstract class Identity implements Principal, Serializable { ...@@ -84,7 +71,6 @@ public abstract class Identity implements Principal, Serializable {
* @throws KeyManagementException * @throws KeyManagementException
* if an {@code Identity} with the same name is already present * if an {@code Identity} with the same name is already present
* in the specified scope. * in the specified scope.
* @since Android 1.0
*/ */
public Identity(String name, IdentityScope scope) public Identity(String name, IdentityScope scope)
throws KeyManagementException { throws KeyManagementException {
...@@ -101,8 +87,7 @@ public abstract class Identity implements Principal, Serializable { ...@@ -101,8 +87,7 @@ public abstract class Identity implements Principal, Serializable {
* If a {@code SecurityManager} is installed, code calling this method needs * If a {@code SecurityManager} is installed, code calling this method needs
* the {@code SecurityPermission} {@code addIdentityCertificate} to be * the {@code SecurityPermission} {@code addIdentityCertificate} to be
* granted, otherwise a {@code SecurityException} will be thrown. * granted, otherwise a {@code SecurityException} will be thrown.
* </p> *
*
* @param certificate * @param certificate
* the {@code Certificate} to be added to this {@code Identity}. * the {@code Certificate} to be added to this {@code Identity}.
* @throws KeyManagementException * @throws KeyManagementException
...@@ -110,7 +95,6 @@ public abstract class Identity implements Principal, Serializable { ...@@ -110,7 +95,6 @@ public abstract class Identity implements Principal, Serializable {
* @throws SecurityException * @throws SecurityException
* if a {@code SecurityManager} is installed and the caller does * if a {@code SecurityManager} is installed and the caller does
* not have permission to invoke this method. * not have permission to invoke this method.
* @since Android 1.0
*/ */
public void addCertificate(Certificate certificate) public void addCertificate(Certificate certificate)
throws KeyManagementException { throws KeyManagementException {
...@@ -163,7 +147,7 @@ public abstract class Identity implements Principal, Serializable { ...@@ -163,7 +147,7 @@ public abstract class Identity implements Principal, Serializable {
* the {@code SecurityPermission} {@code "removeIdentityCertificate"} to be * the {@code SecurityPermission} {@code "removeIdentityCertificate"} to be
* granted, otherwise a {@code SecurityException} will be thrown. * granted, otherwise a {@code SecurityException} will be thrown.
* <p> * <p>
* *
* @param certificate * @param certificate
* the {@code Certificate} to be removed. * the {@code Certificate} to be removed.
* @throws KeyManagementException * @throws KeyManagementException
...@@ -171,7 +155,6 @@ public abstract class Identity implements Principal, Serializable { ...@@ -171,7 +155,6 @@ public abstract class Identity implements Principal, Serializable {
* @throws SecurityException * @throws SecurityException
* if a {@code SecurityManager} is installed and the caller does * if a {@code SecurityManager} is installed and the caller does
* not have permission to invoke this method. * not have permission to invoke this method.
* @since Android 1.0
*/ */
public void removeCertificate(Certificate certificate) public void removeCertificate(Certificate certificate)
throws KeyManagementException { throws KeyManagementException {
...@@ -196,9 +179,8 @@ public abstract class Identity implements Principal, Serializable { ...@@ -196,9 +179,8 @@ public abstract class Identity implements Principal, Serializable {
* Returns the certificates for this {@code Identity}. External * Returns the certificates for this {@code Identity}. External
* modifications of the returned array has no impact on this {@code * modifications of the returned array has no impact on this {@code
* Identity}. * Identity}.
* *
* @return the {@code Certificates} for this {@code Identity} * @return the {@code Certificates} for this {@code Identity}
* @since Android 1.0
*/ */
public Certificate[] certificates() { public Certificate[] certificates() {
if (certificates == null) { if (certificates == null) {
...@@ -219,13 +201,11 @@ public abstract class Identity implements Principal, Serializable { ...@@ -219,13 +201,11 @@ public abstract class Identity implements Principal, Serializable {
* <p> * <p>
* To be equal, two {@code Identity} objects need to have the same name and * To be equal, two {@code Identity} objects need to have the same name and
* the same public keys. * the same public keys.
* </p> *
*
* @param identity * @param identity
* the identity to check for equality. * the identity to check for equality.
* @return {@code true} if the {@code Identity} objects are equal, {@code * @return {@code true} if the {@code Identity} objects are equal, {@code
* false} otherwise. * false} otherwise.
* @since Android 1.0
*/ */
protected boolean identityEquals(Identity identity) { protected boolean identityEquals(Identity identity) {
if (!name.equals(identity.name)) { if (!name.equals(identity.name)) {
...@@ -245,12 +225,11 @@ public abstract class Identity implements Principal, Serializable { ...@@ -245,12 +225,11 @@ public abstract class Identity implements Principal, Serializable {
/** /**
* Returns a string containing a concise, human-readable description of the * Returns a string containing a concise, human-readable description of the
* this {@code Identity}. * this {@code Identity}.
* *
* @param detailed * @param detailed
* whether or not this method should return detailed information. * whether or not this method should return detailed information.
* @return a printable representation for this {@code Permission}. * @return a printable representation for this {@code Permission}.
* @since Android 1.0 */
*/
public String toString(boolean detailed) { public String toString(boolean detailed) {
String s = toString(); String s = toString();
if (detailed) { if (detailed) {
...@@ -264,9 +243,8 @@ public abstract class Identity implements Principal, Serializable { ...@@ -264,9 +243,8 @@ public abstract class Identity implements Principal, Serializable {
/** /**
* Returns the {@code IdentityScope} of this {@code Identity}. * Returns the {@code IdentityScope} of this {@code Identity}.
* *
* @return the {@code IdentityScope} of this {@code Identity}. * @return the {@code IdentityScope} of this {@code Identity}.
* @since Android 1.0
*/ */
public final IdentityScope getScope() { public final IdentityScope getScope() {
return scope; return scope;
...@@ -281,8 +259,7 @@ public abstract class Identity implements Principal, Serializable { ...@@ -281,8 +259,7 @@ public abstract class Identity implements Principal, Serializable {
* If a {@code SecurityManager} is installed, code calling this method needs * If a {@code SecurityManager} is installed, code calling this method needs
* the {@code SecurityPermission} {@code setIdentityPublicKey} to be * the {@code SecurityPermission} {@code setIdentityPublicKey} to be
* granted, otherwise a {@code SecurityException} will be thrown. * granted, otherwise a {@code SecurityException} will be thrown.
* </p> *
*
* @param key * @param key
* the {@code PublicKey} to be set. * the {@code PublicKey} to be set.
* @throws KeyManagementException * @throws KeyManagementException
...@@ -291,7 +268,6 @@ public abstract class Identity implements Principal, Serializable { ...@@ -291,7 +268,6 @@ public abstract class Identity implements Principal, Serializable {
* @throws SecurityException * @throws SecurityException
* if a {@code SecurityManager} is installed and the caller does * if a {@code SecurityManager} is installed and the caller does
* not have permission to invoke this method. * not have permission to invoke this method.
* @since Android 1.0
*/ */
public void setPublicKey(PublicKey key) throws KeyManagementException { public void setPublicKey(PublicKey key) throws KeyManagementException {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
...@@ -315,9 +291,8 @@ public abstract class Identity implements Principal, Serializable { ...@@ -315,9 +291,8 @@ public abstract class Identity implements Principal, Serializable {
/** /**
* Returns the {@code PublicKey} associated with this {@code Identity}. * Returns the {@code PublicKey} associated with this {@code Identity}.
* *
* @return the {@code PublicKey} associated with this {@code Identity}. * @return the {@code PublicKey} associated with this {@code Identity}.
* @since Android 1.0
*/ */
public PublicKey getPublicKey() { public PublicKey getPublicKey() {
return publicKey; return publicKey;
...@@ -332,13 +307,12 @@ public abstract class Identity implements Principal, Serializable { ...@@ -332,13 +307,12 @@ public abstract class Identity implements Principal, Serializable {
* If a {@code SecurityManager} is installed, code calling this method needs * If a {@code SecurityManager} is installed, code calling this method needs
* the {@code SecurityPermission} {@code setIdentityInfo} to be granted, * the {@code SecurityPermission} {@code setIdentityInfo} to be granted,
* otherwise a {@code SecurityException} will be thrown. * otherwise a {@code SecurityException} will be thrown.
* *
* @param info * @param info
* the information to be set. * the information to be set.
* @throws SecurityException * @throws SecurityException
* if a {@code SecurityManager} is installed and the caller does * if a {@code SecurityManager} is installed and the caller does
* not have permission to invoke this method. * not have permission to invoke this method.
* @since Android 1.0
*/ */
public void setInfo(String info) { public void setInfo(String info) {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
...@@ -353,9 +327,8 @@ public abstract class Identity implements Principal, Serializable { ...@@ -353,9 +327,8 @@ public abstract class Identity implements Principal, Serializable {
/** /**
* Returns the information string of this {@code Identity}. * Returns the information string of this {@code Identity}.
* *
* @return the information string of this {@code Identity}. * @return the information string of this {@code Identity}.
* @since Android 1.0
*/ */
public String getInfo() { public String getInfo() {
return info; return info;
...@@ -369,14 +342,14 @@ public abstract class Identity implements Principal, Serializable { ...@@ -369,14 +342,14 @@ public abstract class Identity implements Principal, Serializable {
* returns {@code true} if the specified object is equal, {@code false} * returns {@code true} if the specified object is equal, {@code false}
* otherwise. {@code Identity} objects are considered equal, if they have * otherwise. {@code Identity} objects are considered equal, if they have
* the same name and are in the same scope. * the same name and are in the same scope.
* *
* @param obj * @param obj
* object to be compared for equality with this {@code * object to be compared for equality with this {@code
* Identity}. * Identity}.
* @return {@code true} if the specified object is equal to this {@code * @return {@code true} if the specified object is equal to this {@code
* Identity}, otherwise {@code false}. * Identity}, otherwise {@code false}.
* @since Android 1.0
*/ */
@Override
public final boolean equals(Object obj) { public final boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
...@@ -397,9 +370,8 @@ public abstract class Identity implements Principal, Serializable { ...@@ -397,9 +370,8 @@ public abstract class Identity implements Principal, Serializable {
/** /**
* Returns the name of this {@code Identity}. * Returns the name of this {@code Identity}.
* *
* @return the name of this {@code Identity}. * @return the name of this {@code Identity}.
* @since Android 1.0
*/ */
public final String getName() { public final String getName() {
return name; return name;
...@@ -412,12 +384,12 @@ public abstract class Identity implements Principal, Serializable { ...@@ -412,12 +384,12 @@ public abstract class Identity implements Principal, Serializable {
* Returns the hash code value for this {@code Identity}. Returns the same * Returns the hash code value for this {@code Identity}. Returns the same
* hash code for {@code Identity}s that are equal to each other as required * hash code for {@code Identity}s that are equal to each other as required
* by the general contract of {@link Object#hashCode}. * by the general contract of {@link Object#hashCode}.
* *
* @return the hash code value for this {@code Identity}. * @return the hash code value for this {@code Identity}.
* @see Object#equals(Object) * @see Object#equals(Object)
* @see Identity#equals(Object) * @see Identity#equals(Object)
* @since Android 1.0
*/ */
@Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
if (name != null) { if (name != null) {
...@@ -439,22 +411,22 @@ public abstract class Identity implements Principal, Serializable { ...@@ -439,22 +411,22 @@ public abstract class Identity implements Principal, Serializable {
* If a {@code SecurityManager} is installed, code calling this method * If a {@code SecurityManager} is installed, code calling this method
* needs the {@code SecurityPermission} {@code printIdentity} to be granted, * needs the {@code SecurityPermission} {@code printIdentity} to be granted,
* otherwise a {@code SecurityException} will be thrown. * otherwise a {@code SecurityException} will be thrown.
* </p> *
*
* @return a printable representation for this {@code Identity}. * @return a printable representation for this {@code Identity}.
* @throws SecurityException * @throws SecurityException
* if a {@code SecurityManager} is installed and the caller does * if a {@code SecurityManager} is installed and the caller does
* not have permission to invoke this method. * not have permission to invoke this method.
* @since Android 1.0
*/ */
@Override
@SuppressWarnings("nls")
public String toString() { public String toString() {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkSecurityAccess("printIdentity"); //$NON-NLS-1$ sm.checkSecurityAccess("printIdentity");
} }
String s = (this.name == null? "" : this.name); String s = (this.name == null ? "" : this.name);
if (scope != null) { if (scope != null) {
s += " [" + scope.getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ s += " [" + scope.getName() + "]";
} }
return s; return s;
} }
......
...@@ -15,29 +15,17 @@ ...@@ -15,29 +15,17 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Aleksei Y. Semenov
* @version $Revision$
*/
// BEGIN android-note
// Added Deprecated annotation.
// END android-note
package java.security; package java.security;
import java.util.Enumeration; import java.util.Enumeration;
import org.apache.harmony.security.SystemScope;
/** /**
* {@code IdentityScope} represents a scope for {@link Identity} objects. * {@code IdentityScope} represents a scope for {@link Identity} objects.
* *
* @deprecated The functionality of this class has been replace by * @deprecated The functionality of this class has been replace by
* {@link Principal}, {@link KeyStore} and the {@code * {@link Principal}, {@link KeyStore} and the {@code
* java.security.cert} package. * java.security.cert} package.
* @since Android 1.0
*/ */
@Deprecated @Deprecated
public abstract class IdentityScope extends Identity { public abstract class IdentityScope extends Identity {
...@@ -49,8 +37,6 @@ public abstract class IdentityScope extends Identity { ...@@ -49,8 +37,6 @@ public abstract class IdentityScope extends Identity {
/** /**
* Constructs a new instance of {@code IdentityScope}. * Constructs a new instance of {@code IdentityScope}.
*
* @since Android 1.0
*/ */
protected IdentityScope() { protected IdentityScope() {
super(); super();
...@@ -59,10 +45,9 @@ public abstract class IdentityScope extends Identity { ...@@ -59,10 +45,9 @@ public abstract class IdentityScope extends Identity {
/** /**
* Constructs a new instance of {@code IdentityScope} with the specified * Constructs a new instance of {@code IdentityScope} with the specified
* name. * name.
* *
* @param name * @param name
* the name of this {@code IdentityScope}. * the name of this {@code IdentityScope}.
* @since Android 1.0
*/ */
public IdentityScope(String name) { public IdentityScope(String name) {
super(name); super(name);
...@@ -71,14 +56,13 @@ public abstract class IdentityScope extends Identity { ...@@ -71,14 +56,13 @@ public abstract class IdentityScope extends Identity {
/** /**
* Constructs a new instance of {@code IdentityScope} with the specified * Constructs a new instance of {@code IdentityScope} with the specified
* name and the specified scope. * name and the specified scope.
* *
* @param name * @param name
* the name of this {@code IdentityScope}. * the name of this {@code IdentityScope}.
* @param scope * @param scope
* the scope of this {@code IdentityScope}. * the scope of this {@code IdentityScope}.
* @throws KeyManagementException * @throws KeyManagementException
* if an identity with the same key already exists. * if an identity with the same key already exists.
* @since Android 1.0
*/ */
public IdentityScope(String name, IdentityScope scope) public IdentityScope(String name, IdentityScope scope)
throws KeyManagementException { throws KeyManagementException {
...@@ -87,9 +71,8 @@ public abstract class IdentityScope extends Identity { ...@@ -87,9 +71,8 @@ public abstract class IdentityScope extends Identity {
/** /**
* Returns the system's scope. * Returns the system's scope.
* *
* @return the system's scope. * @return the system's scope.
* @since Android 1.0
*/ */
public static IdentityScope getSystemScope() { public static IdentityScope getSystemScope() {
/* /*
...@@ -116,10 +99,9 @@ public abstract class IdentityScope extends Identity { ...@@ -116,10 +99,9 @@ public abstract class IdentityScope extends Identity {
/** /**
* Sets the system's scope. * Sets the system's scope.
* *
* @param scope * @param scope
* the scope to set. * the scope to set.
* @since Android 1.0
*/ */
protected static void setSystemScope(IdentityScope scope) { protected static void setSystemScope(IdentityScope scope) {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
...@@ -131,21 +113,19 @@ public abstract class IdentityScope extends Identity { ...@@ -131,21 +113,19 @@ public abstract class IdentityScope extends Identity {
/** /**
* Returns the number of {@code Identity} objects in this scope. * Returns the number of {@code Identity} objects in this scope.
* *
* @return the number of {@code Identity} objects in this scope. * @return the number of {@code Identity} objects in this scope.
* @since Android 1.0
*/ */
public abstract int size(); public abstract int size();
/** /**
* Returns the {@code Identity} with the specified name or {@code null} if * Returns the {@code Identity} with the specified name or {@code null} if
* no {@code Identity} with the specified name is present in this scope. * no {@code Identity} with the specified name is present in this scope.
* *
* @param name * @param name
* the name of the {@code Identity} to be returned. * the name of the {@code Identity} to be returned.
* @return the {@code Identity} with the specified name or {@code null} if * @return the {@code Identity} with the specified name or {@code null} if
* not present. * not present.
* @since Android 1.0
*/ */
public abstract Identity getIdentity(String name); public abstract Identity getIdentity(String name);
...@@ -153,13 +133,12 @@ public abstract class IdentityScope extends Identity { ...@@ -153,13 +133,12 @@ public abstract class IdentityScope extends Identity {
* Returns the {@code Identity} with the name of the specified principal or * Returns the {@code Identity} with the name of the specified principal or
* {@code null} if no {@code Identity} with the name of the specified * {@code null} if no {@code Identity} with the name of the specified
* principal is present in this scope. * principal is present in this scope.
* *
* @param principal * @param principal
* the {@code Principal} whose name is used to lookup the {@code * the {@code Principal} whose name is used to lookup the {@code
* Identity} to be returned. * Identity} to be returned.
* @return the {@code Identity} with the specified name or {@code null} if * @return the {@code Identity} with the specified name or {@code null} if
* not present. * not present.
* @since Android 1.0
*/ */
public Identity getIdentity(Principal principal) { public Identity getIdentity(Principal principal) {
return getIdentity(principal.getName()); return getIdentity(principal.getName());
...@@ -169,36 +148,33 @@ public abstract class IdentityScope extends Identity { ...@@ -169,36 +148,33 @@ public abstract class IdentityScope extends Identity {
* Returns the {@code Identity} which is associated with the specified key * Returns the {@code Identity} which is associated with the specified key
* or {@code null} if no {@code Identity} associated with the specified key * or {@code null} if no {@code Identity} associated with the specified key
* is present in this scope. * is present in this scope.
* *
* @param key * @param key
* the {@code PublicKey} of the {@code Identity} to be returned. * the {@code PublicKey} of the {@code Identity} to be returned.
* @return the {@code Identity} associated with the specified key or {@code * @return the {@code Identity} associated with the specified key or {@code
* null} if not present. * null} if not present.
* @since Android 1.0
*/ */
public abstract Identity getIdentity(PublicKey key); public abstract Identity getIdentity(PublicKey key);
/** /**
* Adds an {@code Identity} to this {@code IdentityScope}. * Adds an {@code Identity} to this {@code IdentityScope}.
* *
* @param identity * @param identity
* the {@code Identity} to be added. * the {@code Identity} to be added.
* @throws KeyManagementException * @throws KeyManagementException
* if the specified {@code Identity} is invalid or an identity * if the specified {@code Identity} is invalid or an identity
* with the same key already exists. * with the same key already exists.
* @since Android 1.0
*/ */
public abstract void addIdentity(Identity identity) public abstract void addIdentity(Identity identity)
throws KeyManagementException; throws KeyManagementException;
/** /**
* Removes an {@code Identity} from this {@code IdentityScope}. * Removes an {@code Identity} from this {@code IdentityScope}.
* *
* @param identity * @param identity
* the {@code Identity} to be removed. * the {@code Identity} to be removed.
* @throws KeyManagementException * @throws KeyManagementException
* if the {@code Identity} is not present in this scope. * if the {@code Identity} is not present in this scope.
* @since Android 1.0
*/ */
public abstract void removeIdentity(Identity identity) public abstract void removeIdentity(Identity identity)
throws KeyManagementException; throws KeyManagementException;
...@@ -206,22 +182,21 @@ public abstract class IdentityScope extends Identity { ...@@ -206,22 +182,21 @@ public abstract class IdentityScope extends Identity {
/** /**
* Returns an {@code Enumeration} over the {@code Identity} objects in this * Returns an {@code Enumeration} over the {@code Identity} objects in this
* {@code IdentityScope}. * {@code IdentityScope}.
* *
* @return an {@code Enumeration} over the {@code Identity} objects in this * @return an {@code Enumeration} over the {@code Identity} objects in this
* {@code IdentityScope}. * {@code IdentityScope}.
* @since Android 1.0
*/ */
public abstract Enumeration<Identity> identities(); public abstract Enumeration<Identity> identities();
/** /**
* Returns a string containing a concise, human-readable description of this * Returns a string containing a concise, human-readable description of this
* {@code IdentityScope}. * {@code IdentityScope}.
* *
* @return a printable representation for this {@code IdentityScope}. * @return a printable representation for this {@code IdentityScope}.
* @since Android 1.0
*/ */
@Override
public String toString() { public String toString() {
return new StringBuffer(super.toString()) return new StringBuilder(super.toString())
.append("[").append(size()).append("]").toString(); //$NON-NLS-1$ //$NON-NLS-2$ .append("[").append(size()).append("]").toString(); //$NON-NLS-1$ //$NON-NLS-2$
} }
} }
...@@ -15,31 +15,22 @@ ...@@ -15,31 +15,22 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
/** /**
* {@code InvalidAlgorithmParameterException} indicates the occurrence of * {@code InvalidAlgorithmParameterException} indicates the occurrence of
* invalid algorithm parameters. * invalid algorithm parameters.
*
* @since Android 1.0
*/ */
public class InvalidAlgorithmParameterException extends public class InvalidAlgorithmParameterException extends
GeneralSecurityException { GeneralSecurityException {
private static final long serialVersionUID = 2864672297499471472L; private static final long serialVersionUID = 2864672297499471472L;
/** /**
* Constructs a new instance of {@code InvalidAlgorithmParameterException} * Constructs a new instance of {@code InvalidAlgorithmParameterException}
* with the given message. * with the given message.
* *
* @param msg * @param msg
* the detail message for this exception. * the detail message for this exception.
* @since Android 1.0
*/ */
public InvalidAlgorithmParameterException(String msg) { public InvalidAlgorithmParameterException(String msg) {
super(msg); super(msg);
...@@ -47,8 +38,6 @@ public class InvalidAlgorithmParameterException extends ...@@ -47,8 +38,6 @@ public class InvalidAlgorithmParameterException extends
/** /**
* Constructs a new instance of {@code InvalidAlgorithmParameterException}. * Constructs a new instance of {@code InvalidAlgorithmParameterException}.
*
* @since Android 1.0
*/ */
public InvalidAlgorithmParameterException() { public InvalidAlgorithmParameterException() {
} }
...@@ -56,12 +45,11 @@ public class InvalidAlgorithmParameterException extends ...@@ -56,12 +45,11 @@ public class InvalidAlgorithmParameterException extends
/** /**
* Constructs a new instance of {@code InvalidAlgorithmParameterException} with the * Constructs a new instance of {@code InvalidAlgorithmParameterException} with the
* given message and the cause. * given message and the cause.
* *
* @param message * @param message
* the detail message for this exception. * the detail message for this exception.
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public InvalidAlgorithmParameterException(String message, Throwable cause) { public InvalidAlgorithmParameterException(String message, Throwable cause) {
super(message, cause); super(message, cause);
...@@ -70,10 +58,9 @@ public class InvalidAlgorithmParameterException extends ...@@ -70,10 +58,9 @@ public class InvalidAlgorithmParameterException extends
/** /**
* Constructs a new instance of {@code InvalidAlgorithmParameterException} * Constructs a new instance of {@code InvalidAlgorithmParameterException}
* with the cause. * with the cause.
* *
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public InvalidAlgorithmParameterException(Throwable cause) { public InvalidAlgorithmParameterException(Throwable cause) {
super(cause); super(cause);
......
...@@ -15,18 +15,11 @@ ...@@ -15,18 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
/** /**
* {@code InvalidKeyException} indicates exceptional conditions, caused by an * {@code InvalidKeyException} indicates exceptional conditions, caused by an
* invalid key. * invalid key.
*
* @since Android 1.0
*/ */
public class InvalidKeyException extends KeyException { public class InvalidKeyException extends KeyException {
...@@ -35,10 +28,9 @@ public class InvalidKeyException extends KeyException { ...@@ -35,10 +28,9 @@ public class InvalidKeyException extends KeyException {
/** /**
* Constructs a new instance of {@code InvalidKeyException} with the given * Constructs a new instance of {@code InvalidKeyException} with the given
* message. * message.
* *
* @param msg * @param msg
* the detail message for this exception. * the detail message for this exception.
* @since Android 1.0
*/ */
public InvalidKeyException(String msg) { public InvalidKeyException(String msg) {
super(msg); super(msg);
...@@ -46,8 +38,6 @@ public class InvalidKeyException extends KeyException { ...@@ -46,8 +38,6 @@ public class InvalidKeyException extends KeyException {
/** /**
* Constructs a new instance of {@code InvalidKeyException}. * Constructs a new instance of {@code InvalidKeyException}.
*
* @since Android 1.0
*/ */
public InvalidKeyException() { public InvalidKeyException() {
} }
...@@ -55,12 +45,11 @@ public class InvalidKeyException extends KeyException { ...@@ -55,12 +45,11 @@ public class InvalidKeyException extends KeyException {
/** /**
* Constructs a new instance of {@code InvalidKeyException} with the given * Constructs a new instance of {@code InvalidKeyException} with the given
* message and the cause. * message and the cause.
* *
* @param message * @param message
* the detail message for this exception. * the detail message for this exception.
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public InvalidKeyException(String message, Throwable cause) { public InvalidKeyException(String message, Throwable cause) {
super(message, cause); super(message, cause);
...@@ -68,10 +57,9 @@ public class InvalidKeyException extends KeyException { ...@@ -68,10 +57,9 @@ public class InvalidKeyException extends KeyException {
/** /**
* Constructs a new instance of {@code InvalidKeyException} with the cause. * Constructs a new instance of {@code InvalidKeyException} with the cause.
* *
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public InvalidKeyException(Throwable cause) { public InvalidKeyException(Throwable cause) {
super(cause); super(cause);
......
...@@ -15,18 +15,11 @@ ...@@ -15,18 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
/** /**
* {@code InvalidParameterException} indicates exceptional conditions, caused by * {@code InvalidParameterException} indicates exceptional conditions, caused by
* invalid parameters. * invalid parameters.
*
* @since Android 1.0
*/ */
public class InvalidParameterException extends IllegalArgumentException { public class InvalidParameterException extends IllegalArgumentException {
...@@ -35,10 +28,9 @@ public class InvalidParameterException extends IllegalArgumentException { ...@@ -35,10 +28,9 @@ public class InvalidParameterException extends IllegalArgumentException {
/** /**
* Constructs a new instance of {@code InvalidParameterException} with the * Constructs a new instance of {@code InvalidParameterException} with the
* given message. * given message.
* *
* @param msg * @param msg
* the detail message for this exception. * the detail message for this exception.
* @since Android 1.0
*/ */
public InvalidParameterException(String msg) { public InvalidParameterException(String msg) {
super(msg); super(msg);
...@@ -46,8 +38,6 @@ public class InvalidParameterException extends IllegalArgumentException { ...@@ -46,8 +38,6 @@ public class InvalidParameterException extends IllegalArgumentException {
/** /**
* Constructs a new instance of {@code InvalidParameterException}. * Constructs a new instance of {@code InvalidParameterException}.
*
* @since Android 1.0
*/ */
public InvalidParameterException() { public InvalidParameterException() {
} }
......
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
import java.io.Serializable; import java.io.Serializable;
...@@ -29,14 +24,11 @@ import java.io.Serializable; ...@@ -29,14 +24,11 @@ import java.io.Serializable;
* *
* @see PublicKey * @see PublicKey
* @see PrivateKey * @see PrivateKey
* @since Android 1.0
*/ */
public interface Key extends Serializable { public interface Key extends Serializable {
/** /**
* The {@code serialVersionUID} to be compatible with JDK1.1. * The {@code serialVersionUID} to be compatible with JDK1.1.
*
* @since Android 1.0
*/ */
public static final long serialVersionUID = 6603384152749567654L; public static final long serialVersionUID = 6603384152749567654L;
...@@ -46,7 +38,6 @@ public interface Key extends Serializable { ...@@ -46,7 +38,6 @@ public interface Key extends Serializable {
* *
* @return the name of the algorithm of this key or {@code null} if the * @return the name of the algorithm of this key or {@code null} if the
* algorithm is unknown. * algorithm is unknown.
* @since Android 1.0
*/ */
public String getAlgorithm(); public String getAlgorithm();
...@@ -56,7 +47,6 @@ public interface Key extends Serializable { ...@@ -56,7 +47,6 @@ public interface Key extends Serializable {
* *
* @return the name of the format used to encode this key, or {@code null} * @return the name of the format used to encode this key, or {@code null}
* if it can not be encoded. * if it can not be encoded.
* @since Android 1.0
*/ */
public String getFormat(); public String getFormat();
...@@ -66,7 +56,6 @@ public interface Key extends Serializable { ...@@ -66,7 +56,6 @@ public interface Key extends Serializable {
* *
* @return the encoded form of this key, or {@code null} if encoding is not * @return the encoded form of this key, or {@code null} if encoding is not
* supported by this key. * supported by this key.
* @since Android 1.0
*/ */
public byte[] getEncoded(); public byte[] getEncoded();
} }
...@@ -15,17 +15,10 @@ ...@@ -15,17 +15,10 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
/** /**
* {@code KeyException} is the common superclass of all key related exceptions. * {@code KeyException} is the common superclass of all key related exceptions.
*
* @since Android 1.0
*/ */
public class KeyException extends GeneralSecurityException { public class KeyException extends GeneralSecurityException {
...@@ -33,10 +26,9 @@ public class KeyException extends GeneralSecurityException { ...@@ -33,10 +26,9 @@ public class KeyException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code KeyException} with the given message. * Constructs a new instance of {@code KeyException} with the given message.
* *
* @param msg * @param msg
* the detail message for this exception. * the detail message for this exception.
* @since Android 1.0
*/ */
public KeyException(String msg) { public KeyException(String msg) {
super(msg); super(msg);
...@@ -44,8 +36,6 @@ public class KeyException extends GeneralSecurityException { ...@@ -44,8 +36,6 @@ public class KeyException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code KeyException}. * Constructs a new instance of {@code KeyException}.
*
* @since Android 1.0
*/ */
public KeyException() { public KeyException() {
} }
...@@ -53,12 +43,11 @@ public class KeyException extends GeneralSecurityException { ...@@ -53,12 +43,11 @@ public class KeyException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code KeyException} with the given message * Constructs a new instance of {@code KeyException} with the given message
* and the cause. * and the cause.
* *
* @param message * @param message
* the detail message for this exception. * the detail message for this exception.
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public KeyException(String message, Throwable cause) { public KeyException(String message, Throwable cause) {
super(message, cause); super(message, cause);
...@@ -66,10 +55,9 @@ public class KeyException extends GeneralSecurityException { ...@@ -66,10 +55,9 @@ public class KeyException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code KeyException} with the cause. * Constructs a new instance of {@code KeyException} with the cause.
* *
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public KeyException(Throwable cause) { public KeyException(Throwable cause) {
super(cause); super(cause);
......
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Boris V. Kuznetsov
* @version $Revision$
*/
package java.security; package java.security;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
...@@ -33,8 +28,6 @@ import org.apache.harmony.security.internal.nls.Messages; ...@@ -33,8 +28,6 @@ import org.apache.harmony.security.internal.nls.Messages;
* public and private key objects and convert keys between their external * public and private key objects and convert keys between their external
* representation, that can be easily transported and their internal * representation, that can be easily transported and their internal
* representation. * representation.
*
* @since Android 1.0
*/ */
public class KeyFactory { public class KeyFactory {
// The service name. // The service name.
...@@ -63,7 +56,6 @@ public class KeyFactory { ...@@ -63,7 +56,6 @@ public class KeyFactory {
* the provider. * the provider.
* @param algorithm * @param algorithm
* the algorithm to use. * the algorithm to use.
* @since Android 1.0
*/ */
protected KeyFactory(KeyFactorySpi keyFacSpi, protected KeyFactory(KeyFactorySpi keyFacSpi,
Provider provider, Provider provider,
...@@ -83,7 +75,6 @@ public class KeyFactory { ...@@ -83,7 +75,6 @@ public class KeyFactory {
* algorithm. * algorithm.
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
* if no provider provides the requested algorithm. * if no provider provides the requested algorithm.
* @since Android 1.0
*/ */
public static KeyFactory getInstance(String algorithm) public static KeyFactory getInstance(String algorithm)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
...@@ -112,16 +103,16 @@ public class KeyFactory { ...@@ -112,16 +103,16 @@ public class KeyFactory {
* if the requested provider is not available. * if the requested provider is not available.
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if {@code provider} is {@code null} or empty. * if {@code provider} is {@code null} or empty.
* @since Android 1.0
*/ */
@SuppressWarnings("nls")
public static KeyFactory getInstance(String algorithm, String provider) public static KeyFactory getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException { throws NoSuchAlgorithmException, NoSuchProviderException {
if ((provider == null) || (provider.length() == 0)) { if ((provider == null) || (provider.length() == 0)) {
throw new IllegalArgumentException(Messages.getString("security.02")); //$NON-NLS-1$ throw new IllegalArgumentException(Messages.getString("security.02"));
} }
Provider p = Security.getProvider(provider); Provider p = Security.getProvider(provider);
if (p == null) { if (p == null) {
throw new NoSuchProviderException(Messages.getString("security.03", provider)); //$NON-NLS-1$ //$NON-NLS-2$ throw new NoSuchProviderException(Messages.getString("security.03", provider));
} }
return getInstance(algorithm, p); return getInstance(algorithm, p);
} }
...@@ -138,7 +129,6 @@ public class KeyFactory { ...@@ -138,7 +129,6 @@ public class KeyFactory {
* algorithm from the specified provider. * algorithm from the specified provider.
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
* if the provider does not provide the requested algorithm. * if the provider does not provide the requested algorithm.
* @since Android 1.0
*/ */
public static KeyFactory getInstance(String algorithm, Provider provider) public static KeyFactory getInstance(String algorithm, Provider provider)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
...@@ -158,19 +148,17 @@ public class KeyFactory { ...@@ -158,19 +148,17 @@ public class KeyFactory {
* Returns the provider associated with this {@code KeyFactory}. * Returns the provider associated with this {@code KeyFactory}.
* *
* @return the provider associated with this {@code KeyFactory}. * @return the provider associated with this {@code KeyFactory}.
* @since Android 1.0
*/ */
public final Provider getProvider() { public final Provider getProvider() {
return provider; return provider;
} }
/** /**
* Returns the name of the algorithm associated with this {@code KeyFactory} * Returns the name of the algorithm associated with this {@code
* . * KeyFactory}.
* *
* @return the name of the algorithm associated with this {@code KeyFactory} * @return the name of the algorithm associated with this {@code
* . * KeyFactory}.
* @since Android 1.0
*/ */
public final String getAlgorithm() { public final String getAlgorithm() {
return algorithm; return algorithm;
...@@ -185,7 +173,6 @@ public class KeyFactory { ...@@ -185,7 +173,6 @@ public class KeyFactory {
* @return the public key * @return the public key
* @throws InvalidKeySpecException * @throws InvalidKeySpecException
* if the specified {@code keySpec} is invalid * if the specified {@code keySpec} is invalid
* @since Android 1.0
*/ */
public final PublicKey generatePublic(KeySpec keySpec) public final PublicKey generatePublic(KeySpec keySpec)
throws InvalidKeySpecException { throws InvalidKeySpecException {
...@@ -201,7 +188,6 @@ public class KeyFactory { ...@@ -201,7 +188,6 @@ public class KeyFactory {
* @return the private key. * @return the private key.
* @throws InvalidKeySpecException * @throws InvalidKeySpecException
* if the specified {@code keySpec} is invalid. * if the specified {@code keySpec} is invalid.
* @since Android 1.0
*/ */
public final PrivateKey generatePrivate(KeySpec keySpec) public final PrivateKey generatePrivate(KeySpec keySpec)
throws InvalidKeySpecException { throws InvalidKeySpecException {
...@@ -211,6 +197,9 @@ public class KeyFactory { ...@@ -211,6 +197,9 @@ public class KeyFactory {
/** /**
* Returns the key specification for the specified key. * Returns the key specification for the specified key.
* *
* @param <T>
* The key type
*
* @param key * @param key
* the key from which the specification is requested. * the key from which the specification is requested.
* @param keySpec * @param keySpec
...@@ -219,7 +208,6 @@ public class KeyFactory { ...@@ -219,7 +208,6 @@ public class KeyFactory {
* @throws InvalidKeySpecException * @throws InvalidKeySpecException
* if the key can not be processed, or the requested requested * if the key can not be processed, or the requested requested
* {@code KeySpec} is inappropriate for the given key. * {@code KeySpec} is inappropriate for the given key.
* @since Android 1.0
*/ */
public final <T extends KeySpec> T getKeySpec(Key key, public final <T extends KeySpec> T getKeySpec(Key key,
Class<T> keySpec) Class<T> keySpec)
...@@ -236,7 +224,6 @@ public class KeyFactory { ...@@ -236,7 +224,6 @@ public class KeyFactory {
* @throws InvalidKeyException * @throws InvalidKeyException
* if the specified key can not be translated by this key * if the specified key can not be translated by this key
* factory. * factory.
* @since Android 1.0
*/ */
public final Key translateKey(Key key) public final Key translateKey(Key key)
throws InvalidKeyException { throws InvalidKeyException {
......
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Boris V. Kuznetsov
* @version $Revision$
*/
package java.security; package java.security;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
...@@ -30,7 +25,6 @@ import java.security.spec.KeySpec; ...@@ -30,7 +25,6 @@ import java.security.spec.KeySpec;
* {@link KeyFactory}. * {@link KeyFactory}.
* *
* @see KeyFactory * @see KeyFactory
* @since Android 1.0
*/ */
public abstract class KeyFactorySpi { public abstract class KeyFactorySpi {
...@@ -43,7 +37,6 @@ public abstract class KeyFactorySpi { ...@@ -43,7 +37,6 @@ public abstract class KeyFactorySpi {
* @return the public key. * @return the public key.
* @throws InvalidKeySpecException * @throws InvalidKeySpecException
* if the specified {@code keySpec} is invalid. * if the specified {@code keySpec} is invalid.
* @since Android 1.0
*/ */
protected abstract PublicKey engineGeneratePublic(KeySpec keySpec) protected abstract PublicKey engineGeneratePublic(KeySpec keySpec)
throws InvalidKeySpecException; throws InvalidKeySpecException;
...@@ -57,7 +50,6 @@ public abstract class KeyFactorySpi { ...@@ -57,7 +50,6 @@ public abstract class KeyFactorySpi {
* @return the private key. * @return the private key.
* @throws InvalidKeySpecException * @throws InvalidKeySpecException
* if the specified {@code keySpec} is invalid. * if the specified {@code keySpec} is invalid.
* @since Android 1.0
*/ */
protected abstract PrivateKey engineGeneratePrivate(KeySpec keySpec) protected abstract PrivateKey engineGeneratePrivate(KeySpec keySpec)
throws InvalidKeySpecException; throws InvalidKeySpecException;
...@@ -73,7 +65,6 @@ public abstract class KeyFactorySpi { ...@@ -73,7 +65,6 @@ public abstract class KeyFactorySpi {
* @throws InvalidKeySpecException * @throws InvalidKeySpecException
* if the key can not be processed, or the requested requested * if the key can not be processed, or the requested requested
* {@code KeySpec} is inappropriate for the given key. * {@code KeySpec} is inappropriate for the given key.
* @since Android 1.0
*/ */
protected abstract <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec) protected abstract <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec)
throws InvalidKeySpecException; throws InvalidKeySpecException;
...@@ -88,7 +79,6 @@ public abstract class KeyFactorySpi { ...@@ -88,7 +79,6 @@ public abstract class KeyFactorySpi {
* @throws InvalidKeyException * @throws InvalidKeyException
* if the specified key can not be translated by this key * if the specified key can not be translated by this key
* factory. * factory.
* @since Android 1.0
*/ */
protected abstract Key engineTranslateKey(Key key) throws InvalidKeyException; protected abstract Key engineTranslateKey(Key key) throws InvalidKeyException;
......
...@@ -15,18 +15,11 @@ ...@@ -15,18 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
/** /**
* {@code KeyManagementException} is a general exception, thrown to indicate an * {@code KeyManagementException} is a general exception, thrown to indicate an
* exception during processing an operation concerning key management. * exception during processing an operation concerning key management.
*
* @since Android 1.0
*/ */
public class KeyManagementException extends KeyException { public class KeyManagementException extends KeyException {
...@@ -35,10 +28,9 @@ public class KeyManagementException extends KeyException { ...@@ -35,10 +28,9 @@ public class KeyManagementException extends KeyException {
/** /**
* Constructs a new instance of {@code KeyManagementException} with the * Constructs a new instance of {@code KeyManagementException} with the
* given message. * given message.
* *
* @param msg * @param msg
* the detail message for this exception. * the detail message for this exception.
* @since Android 1.0
*/ */
public KeyManagementException(String msg) { public KeyManagementException(String msg) {
super(msg); super(msg);
...@@ -46,8 +38,6 @@ public class KeyManagementException extends KeyException { ...@@ -46,8 +38,6 @@ public class KeyManagementException extends KeyException {
/** /**
* Constructs a new instance of {@code KeyManagementException}. * Constructs a new instance of {@code KeyManagementException}.
*
* @since Android 1.0
*/ */
public KeyManagementException() { public KeyManagementException() {
} }
...@@ -55,12 +45,11 @@ public class KeyManagementException extends KeyException { ...@@ -55,12 +45,11 @@ public class KeyManagementException extends KeyException {
/** /**
* Constructs a new instance of {@code KeyManagementException} with the * Constructs a new instance of {@code KeyManagementException} with the
* given message and the cause. * given message and the cause.
* *
* @param message * @param message
* the detail message for this exception. * the detail message for this exception.
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public KeyManagementException(String message, Throwable cause) { public KeyManagementException(String message, Throwable cause) {
super(message, cause); super(message, cause);
...@@ -69,13 +58,12 @@ public class KeyManagementException extends KeyException { ...@@ -69,13 +58,12 @@ public class KeyManagementException extends KeyException {
/** /**
* Constructs a new instance of {@code KeyManagementException} with the * Constructs a new instance of {@code KeyManagementException} with the
* cause. * cause.
* *
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public KeyManagementException(Throwable cause) { public KeyManagementException(Throwable cause) {
super(cause); super(cause);
} }
} }
\ No newline at end of file
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vladimir N. Molotkov
* @version $Revision$
*/
package java.security; package java.security;
import java.io.Serializable; import java.io.Serializable;
...@@ -30,7 +25,6 @@ import java.io.Serializable; ...@@ -30,7 +25,6 @@ import java.io.Serializable;
* *
* @see PrivateKey * @see PrivateKey
* @see PublicKey * @see PublicKey
* @since Android 1.0
*/ */
public final class KeyPair implements Serializable { public final class KeyPair implements Serializable {
...@@ -41,12 +35,11 @@ public final class KeyPair implements Serializable { ...@@ -41,12 +35,11 @@ public final class KeyPair implements Serializable {
/** /**
* Constructs a new instance of {@code KeyPair} with a public key and the * Constructs a new instance of {@code KeyPair} with a public key and the
* corresponding private key. * corresponding private key.
* *
* @param publicKey * @param publicKey
* the public key. * the public key.
* @param privateKey * @param privateKey
* the private key. * the private key.
* @since Android 1.0
*/ */
public KeyPair(PublicKey publicKey, PrivateKey privateKey) { public KeyPair(PublicKey publicKey, PrivateKey privateKey) {
this.privateKey = privateKey; this.privateKey = privateKey;
...@@ -55,9 +48,8 @@ public final class KeyPair implements Serializable { ...@@ -55,9 +48,8 @@ public final class KeyPair implements Serializable {
/** /**
* Returns the private key. * Returns the private key.
* *
* @return the private key. * @return the private key.
* @since Android 1.0
*/ */
public PrivateKey getPrivate() { public PrivateKey getPrivate() {
return privateKey; return privateKey;
...@@ -65,9 +57,8 @@ public final class KeyPair implements Serializable { ...@@ -65,9 +57,8 @@ public final class KeyPair implements Serializable {
/** /**
* Returns the public key. * Returns the public key.
* *
* @return the public key. * @return the public key.
* @since Android 1.0
*/ */
public PublicKey getPublic() { public PublicKey getPublic() {
return publicKey; return publicKey;
......
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
...@@ -32,9 +27,8 @@ import org.apache.harmony.security.internal.nls.Messages; ...@@ -32,9 +27,8 @@ import org.apache.harmony.security.internal.nls.Messages;
* {@code KeyPairGenerator} is an engine class which is capable of generating a * {@code KeyPairGenerator} is an engine class which is capable of generating a
* private key and its related public key utilizing the algorithm it was * private key and its related public key utilizing the algorithm it was
* initialized with. * initialized with.
* *
* @see KeyPairGeneratorSpi * @see KeyPairGeneratorSpi
* @since Android 1.0
*/ */
public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
...@@ -56,10 +50,9 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -56,10 +50,9 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
/** /**
* Constructs a new instance of {@code KeyPairGenerator} with the name of * Constructs a new instance of {@code KeyPairGenerator} with the name of
* the algorithm to use. * the algorithm to use.
* *
* @param algorithm * @param algorithm
* the name of algorithm to use * the name of algorithm to use
* @since Android 1.0
*/ */
protected KeyPairGenerator(String algorithm) { protected KeyPairGenerator(String algorithm) {
this.algorithm = algorithm; this.algorithm = algorithm;
...@@ -67,9 +60,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -67,9 +60,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
/** /**
* Returns the name of the algorithm of this {@code KeyPairGenerator}. * Returns the name of the algorithm of this {@code KeyPairGenerator}.
* *
* @return the name of the algorithm of this {@code KeyPairGenerator} * @return the name of the algorithm of this {@code KeyPairGenerator}
* @since Android 1.0
*/ */
public String getAlgorithm() { public String getAlgorithm() {
return algorithm; return algorithm;
...@@ -86,7 +78,6 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -86,7 +78,6 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* @throws NoSuchAlgorithmException if the specified algorithm is not available * @throws NoSuchAlgorithmException if the specified algorithm is not available
* @throws NullPointerException * @throws NullPointerException
* if {@code algorithm} is {@code null} * if {@code algorithm} is {@code null}
* @since Android 1.0
*/ */
public static KeyPairGenerator getInstance(String algorithm) public static KeyPairGenerator getInstance(String algorithm)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
...@@ -101,11 +92,10 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -101,11 +92,10 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
result.algorithm = algorithm; result.algorithm = algorithm;
result.provider = engine.provider; result.provider = engine.provider;
return result; return result;
} else {
result = new KeyPairGeneratorImpl((KeyPairGeneratorSpi) engine.spi,
engine.provider, algorithm);
return result;
} }
result = new KeyPairGeneratorImpl((KeyPairGeneratorSpi) engine.spi,
engine.provider, algorithm);
return result;
} }
} }
...@@ -123,7 +113,6 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -123,7 +113,6 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* @throws NoSuchProviderException if the specified provider is not available * @throws NoSuchProviderException if the specified provider is not available
* @throws NullPointerException * @throws NullPointerException
* if {@code algorithm} is {@code null} * if {@code algorithm} is {@code null}
* @since Android 1.0
*/ */
public static KeyPairGenerator getInstance(String algorithm, String provider) public static KeyPairGenerator getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException { throws NoSuchAlgorithmException, NoSuchProviderException {
...@@ -151,7 +140,6 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -151,7 +140,6 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* @throws NoSuchAlgorithmException if the specified algorithm is not available * @throws NoSuchAlgorithmException if the specified algorithm is not available
* @throws NullPointerException * @throws NullPointerException
* if {@code algorithm} is {@code null} * if {@code algorithm} is {@code null}
* @since Android 1.0
*/ */
public static KeyPairGenerator getInstance(String algorithm, public static KeyPairGenerator getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException { Provider provider) throws NoSuchAlgorithmException {
...@@ -169,19 +157,17 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -169,19 +157,17 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
result.algorithm = algorithm; result.algorithm = algorithm;
result.provider = provider; result.provider = provider;
return result; return result;
} else {
result = new KeyPairGeneratorImpl((KeyPairGeneratorSpi) engine.spi,
provider, algorithm);
return result;
} }
result = new KeyPairGeneratorImpl((KeyPairGeneratorSpi) engine.spi,
provider, algorithm);
return result;
} }
} }
/** /**
* Returns the provider associated with this {@code KeyPairGenerator}. * Returns the provider associated with this {@code KeyPairGenerator}.
* *
* @return the provider associated with this {@code KeyPairGenerator} * @return the provider associated with this {@code KeyPairGenerator}
* @since Android 1.0
*/ */
public final Provider getProvider() { public final Provider getProvider() {
return provider; return provider;
...@@ -191,10 +177,9 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -191,10 +177,9 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* Initializes this {@code KeyPairGenerator} with the given key size. The * Initializes this {@code KeyPairGenerator} with the given key size. The
* default parameter set and a default {@code SecureRandom} instance will be * default parameter set and a default {@code SecureRandom} instance will be
* used. * used.
* *
* @param keysize * @param keysize
* the size of the key (number of bits) * the size of the key (number of bits)
* @since Android 1.0
*/ */
public void initialize(int keysize) { public void initialize(int keysize) {
initialize(keysize, random); initialize(keysize, random);
...@@ -204,12 +189,11 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -204,12 +189,11 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* Initializes this {@code KeyPairGenerator} with the given {@code * Initializes this {@code KeyPairGenerator} with the given {@code
* AlgorithmParameterSpec}. A default {@code SecureRandom} instance will be * AlgorithmParameterSpec}. A default {@code SecureRandom} instance will be
* used. * used.
* *
* @param param * @param param
* the parameters to use * the parameters to use
* @throws InvalidAlgorithmParameterException * @throws InvalidAlgorithmParameterException
* if the specified parameters are not supported * if the specified parameters are not supported
* @since Android 1.0
*/ */
public void initialize(AlgorithmParameterSpec param) public void initialize(AlgorithmParameterSpec param)
throws InvalidAlgorithmParameterException { throws InvalidAlgorithmParameterException {
...@@ -221,9 +205,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -221,9 +205,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* is called. * is called.
* <p> * <p>
* This does exactly the same as {@link #generateKeyPair()}. * This does exactly the same as {@link #generateKeyPair()}.
* *
* @return a new unique {@code KeyPair} each time this method is called * @return a new unique {@code KeyPair} each time this method is called
* @since Android 1.0
*/ */
public final KeyPair genKeyPair() { public final KeyPair genKeyPair() {
return generateKeyPair(); return generateKeyPair();
...@@ -234,10 +217,10 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -234,10 +217,10 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* is called. * is called.
* <p> * <p>
* This does exactly the same as {@link #genKeyPair()}. * This does exactly the same as {@link #genKeyPair()}.
* *
* @return a new unique {@code KeyPair} each time this method is called * @return a new unique {@code KeyPair} each time this method is called
* @since Android 1.0
*/ */
@Override
public KeyPair generateKeyPair() { public KeyPair generateKeyPair() {
return null; return null;
} }
...@@ -245,28 +228,28 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -245,28 +228,28 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
/** /**
* Initializes this {@code KeyPairGenerator} with the given key size and the * Initializes this {@code KeyPairGenerator} with the given key size and the
* given {@code SecureRandom}. The default parameter set will be used. * given {@code SecureRandom}. The default parameter set will be used.
* *
* @param keysize * @param keysize
* the key size * the key size
* @param random * @param random
* the source of randomness * the source of randomness
* @since Android 1.0
*/ */
@Override
public void initialize(int keysize, SecureRandom random) { public void initialize(int keysize, SecureRandom random) {
} }
/** /**
* Initializes this {@code KeyPairGenerator} with the given {@code * Initializes this {@code KeyPairGenerator} with the given {@code
* AlgorithmParameterSpec} and the given {@code SecureRandom}. * AlgorithmParameterSpec} and the given {@code SecureRandom}.
* *
* @param param * @param param
* the parameters to use * the parameters to use
* @param random * @param random
* the source of randomness * the source of randomness
* @throws InvalidAlgorithmParameterException * @throws InvalidAlgorithmParameterException
* if the specified parameters are not supported * if the specified parameters are not supported
* @since Android 1.0
*/ */
@Override
public void initialize(AlgorithmParameterSpec param, SecureRandom random) public void initialize(AlgorithmParameterSpec param, SecureRandom random)
throws InvalidAlgorithmParameterException { throws InvalidAlgorithmParameterException {
} }
...@@ -294,18 +277,21 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -294,18 +277,21 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
// implementation of initialize(int keysize, SecureRandom random) // implementation of initialize(int keysize, SecureRandom random)
// using corresponding spi initialize() method // using corresponding spi initialize() method
@Override
public void initialize(int keysize, SecureRandom random) { public void initialize(int keysize, SecureRandom random) {
spiImpl.initialize(keysize, random); spiImpl.initialize(keysize, random);
} }
// implementation of generateKeyPair() // implementation of generateKeyPair()
// using corresponding spi generateKeyPair() method // using corresponding spi generateKeyPair() method
@Override
public KeyPair generateKeyPair() { public KeyPair generateKeyPair() {
return spiImpl.generateKeyPair(); return spiImpl.generateKeyPair();
} }
// implementation of initialize(int keysize, SecureRandom random) // implementation of initialize(int keysize, SecureRandom random)
// using corresponding spi initialize() method // using corresponding spi initialize() method
@Override
public void initialize(AlgorithmParameterSpec param, SecureRandom random) public void initialize(AlgorithmParameterSpec param, SecureRandom random)
throws InvalidAlgorithmParameterException { throws InvalidAlgorithmParameterException {
spiImpl.initialize(param, random); spiImpl.initialize(param, random);
...@@ -313,4 +299,4 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { ...@@ -313,4 +299,4 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
} }
} }
\ No newline at end of file
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
...@@ -31,14 +26,10 @@ import org.apache.harmony.security.internal.nls.Messages; ...@@ -31,14 +26,10 @@ import org.apache.harmony.security.internal.nls.Messages;
* definition for {@link KeyPairGenerator}. * definition for {@link KeyPairGenerator}.
* *
* @see KeyPairGenerator * @see KeyPairGenerator
* @since Android 1.0
*/ */
public abstract class KeyPairGeneratorSpi { public abstract class KeyPairGeneratorSpi {
/** /**
* Constructs a new instance of {@code KeyPairGeneratorSpi}. * Constructs a new instance of {@code KeyPairGeneratorSpi}.
*
* @since Android 1.0
*/ */
public KeyPairGeneratorSpi() { public KeyPairGeneratorSpi() {
} }
...@@ -46,38 +37,35 @@ public abstract class KeyPairGeneratorSpi { ...@@ -46,38 +37,35 @@ public abstract class KeyPairGeneratorSpi {
/** /**
* Computes and returns a new unique {@code KeyPair} each time this method * Computes and returns a new unique {@code KeyPair} each time this method
* is called. * is called.
* *
* @return a new unique {@code KeyPair} each time this method is called. * @return a new unique {@code KeyPair} each time this method is called.
* @since Android 1.0
*/ */
public abstract KeyPair generateKeyPair(); public abstract KeyPair generateKeyPair();
/** /**
* Initializes this {@code KeyPairGeneratorSpi} with the given key size and * Initializes this {@code KeyPairGeneratorSpi} with the given key size and
* the given {@code SecureRandom}. The default parameter set will be used. * the given {@code SecureRandom}. The default parameter set will be used.
* *
* @param keysize * @param keysize
* the key size (number of bits). * the key size (number of bits).
* @param random * @param random
* the source of randomness. * the source of randomness.
* @since Android 1.0
*/ */
public abstract void initialize(int keysize, SecureRandom random); public abstract void initialize(int keysize, SecureRandom random);
/** /**
* Initializes this {@code KeyPairGeneratorSpi} with the given {@code * Initializes this {@code KeyPairGeneratorSpi} with the given {@code
* AlgorithmParameterSpec} and the given {@code SecureRandom}. * AlgorithmParameterSpec} and the given {@code SecureRandom}.
* *
* @param params * @param params
* the parameters to use. * the parameters to use.
* @param random * @param random
* the source of randomness. * the source of randomness.
* @throws InvalidAlgorithmParameterException * @throws InvalidAlgorithmParameterException
* if the specified parameters are not supported. * if the specified parameters are not supported.
* @since Android 1.0
*/ */
public void initialize(AlgorithmParameterSpec params, SecureRandom random) public void initialize(AlgorithmParameterSpec params, SecureRandom random)
throws InvalidAlgorithmParameterException { throws InvalidAlgorithmParameterException {
throw new UnsupportedOperationException(Messages.getString("security.2E")); //$NON-NLS-1$ throw new UnsupportedOperationException(Messages.getString("security.2E")); //$NON-NLS-1$
} }
} }
\ No newline at end of file
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vladimir N. Molotkov
* @version $Revision$
*/
package java.security; package java.security;
import java.io.IOException; import java.io.IOException;
...@@ -38,8 +33,6 @@ import org.apache.harmony.security.internal.nls.Messages; ...@@ -38,8 +33,6 @@ import org.apache.harmony.security.internal.nls.Messages;
/** /**
* {@code KeyRep} is a standardized representation for serialized {@link Key} * {@code KeyRep} is a standardized representation for serialized {@link Key}
* objects. * objects.
*
* @since Android 1.0
*/ */
public class KeyRep implements Serializable { public class KeyRep implements Serializable {
...@@ -57,7 +50,7 @@ public class KeyRep implements Serializable { ...@@ -57,7 +50,7 @@ public class KeyRep implements Serializable {
* Constructs a new instance of {@code KeyRep} with the specified arguments. * Constructs a new instance of {@code KeyRep} with the specified arguments.
* The arguments should be obtained from the {@code Key} object that has to * The arguments should be obtained from the {@code Key} object that has to
* be serialized. * be serialized.
* *
* @param type * @param type
* the type of the key. * the type of the key.
* @param algorithm * @param algorithm
...@@ -70,7 +63,6 @@ public class KeyRep implements Serializable { ...@@ -70,7 +63,6 @@ public class KeyRep implements Serializable {
* @throws NullPointerException * @throws NullPointerException
* if {@code type, algorithm, format or encoded} is {@code null} * if {@code type, algorithm, format or encoded} is {@code null}
* . * .
* @since Android 1.0
*/ */
public KeyRep(Type type, public KeyRep(Type type,
String algorithm, String format, byte[] encoded) { String algorithm, String format, byte[] encoded) {
...@@ -107,12 +99,11 @@ public class KeyRep implements Serializable { ...@@ -107,12 +99,11 @@ public class KeyRep implements Serializable {
* initialized with a {@link X509EncodedKeySpec} using the encoded key * initialized with a {@link X509EncodedKeySpec} using the encoded key
* bytes. * bytes.
* </ul> * </ul>
* *
* @return the resolved {@code Key} object. * @return the resolved {@code Key} object.
* @throws ObjectStreamException * @throws ObjectStreamException
* if the {@code Type}|format combination is not recognized, or * if the {@code Type}|format combination is not recognized, or
* the resolution of any key parameter fails. * the resolution of any key parameter fails.
* @since Android 1.0
*/ */
protected Object readResolve() throws ObjectStreamException { protected Object readResolve() throws ObjectStreamException {
switch (type) { switch (type) {
...@@ -174,10 +165,8 @@ public class KeyRep implements Serializable { ...@@ -174,10 +165,8 @@ public class KeyRep implements Serializable {
/** /**
* {@code Type} enumerates the supported key types. * {@code Type} enumerates the supported key types.
* @since Android 1.0
*/ */
public static enum Type { public static enum Type {
/** /**
* Type for secret keys. * Type for secret keys.
*/ */
......
...@@ -15,18 +15,12 @@ ...@@ -15,18 +15,12 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
/** /**
* {@code KeyStoreException} is a general {@code KeyStore} exception. * {@code KeyStoreException} is a general {@code KeyStore} exception.
* *
* @see KeyStore * @see KeyStore
* @since Android 1.0
*/ */
public class KeyStoreException extends GeneralSecurityException { public class KeyStoreException extends GeneralSecurityException {
...@@ -35,10 +29,9 @@ public class KeyStoreException extends GeneralSecurityException { ...@@ -35,10 +29,9 @@ public class KeyStoreException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code KeyStoreException} with the * Constructs a new instance of {@code KeyStoreException} with the
* given message. * given message.
* *
* @param msg * @param msg
* the detail message for this exception. * the detail message for this exception.
* @since Android 1.0
*/ */
public KeyStoreException(String msg) { public KeyStoreException(String msg) {
super(msg); super(msg);
...@@ -46,8 +39,6 @@ public class KeyStoreException extends GeneralSecurityException { ...@@ -46,8 +39,6 @@ public class KeyStoreException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code KeyStoreException}. * Constructs a new instance of {@code KeyStoreException}.
*
* @since Android 1.0
*/ */
public KeyStoreException() { public KeyStoreException() {
} }
...@@ -55,12 +46,11 @@ public class KeyStoreException extends GeneralSecurityException { ...@@ -55,12 +46,11 @@ public class KeyStoreException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code KeyStoreException} with the * Constructs a new instance of {@code KeyStoreException} with the
* given message and the cause. * given message and the cause.
* *
* @param message * @param message
* the detail message for this exception. * the detail message for this exception.
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public KeyStoreException(String message, Throwable cause) { public KeyStoreException(String message, Throwable cause) {
super(message, cause); super(message, cause);
...@@ -69,10 +59,9 @@ public class KeyStoreException extends GeneralSecurityException { ...@@ -69,10 +59,9 @@ public class KeyStoreException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code KeyStoreException} with the * Constructs a new instance of {@code KeyStoreException} with the
* cause. * cause.
* *
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public KeyStoreException(Throwable cause) { public KeyStoreException(Throwable cause) {
super(cause); super(cause);
......
...@@ -33,16 +33,15 @@ import org.apache.harmony.security.internal.nls.Messages; ...@@ -33,16 +33,15 @@ import org.apache.harmony.security.internal.nls.Messages;
/** /**
* {@code KeyStoreSpi} is the Service Provider Interface (SPI) definition for * {@code KeyStoreSpi} is the Service Provider Interface (SPI) definition for
* {@link KeyStore}. * {@link KeyStore}.
* *
* @see KeyStore * @see KeyStore
* @since Android 1.0
*/ */
public abstract class KeyStoreSpi { public abstract class KeyStoreSpi {
/** /**
* Returns the key with the given alias, using the password to recover the * Returns the key with the given alias, using the password to recover the
* key from the store. * key from the store.
* *
* @param alias * @param alias
* the alias for the entry. * the alias for the entry.
* @param password * @param password
...@@ -53,41 +52,37 @@ public abstract class KeyStoreSpi { ...@@ -53,41 +52,37 @@ public abstract class KeyStoreSpi {
* if the algorithm for recovering the key is not available. * if the algorithm for recovering the key is not available.
* @throws UnrecoverableKeyException * @throws UnrecoverableKeyException
* if the key can not be recovered. * if the key can not be recovered.
* @since Android 1.0
*/ */
public abstract Key engineGetKey(String alias, char[] password) public abstract Key engineGetKey(String alias, char[] password)
throws NoSuchAlgorithmException, UnrecoverableKeyException; throws NoSuchAlgorithmException, UnrecoverableKeyException;
/** /**
* Returns the certificate chain for the entry with the given alias. * Returns the certificate chain for the entry with the given alias.
* *
* @param alias * @param alias
* the alias for the entry * the alias for the entry
* @return the certificate chain for the entry with the given alias, or * @return the certificate chain for the entry with the given alias, or
* {@code null} if the specified alias is not bound to an entry. * {@code null} if the specified alias is not bound to an entry.
* @since Android 1.0
*/ */
public abstract Certificate[] engineGetCertificateChain(String alias); public abstract Certificate[] engineGetCertificateChain(String alias);
/** /**
* Returns the trusted certificate for the entry with the given alias. * Returns the trusted certificate for the entry with the given alias.
* *
* @param alias * @param alias
* the alias for the entry. * the alias for the entry.
* @return the trusted certificate for the entry with the given alias, or * @return the trusted certificate for the entry with the given alias, or
* {@code null} if the specified alias is not bound to an entry. * {@code null} if the specified alias is not bound to an entry.
* @since Android 1.0
*/ */
public abstract Certificate engineGetCertificate(String alias); public abstract Certificate engineGetCertificate(String alias);
/** /**
* Returns the creation date of the entry with the given alias. * Returns the creation date of the entry with the given alias.
* *
* @param alias * @param alias
* the alias for the entry. * the alias for the entry.
* @return the creation date, or {@code null} if the specified alias is not * @return the creation date, or {@code null} if the specified alias is not
* bound to an entry. * bound to an entry.
* @since Android 1.0
*/ */
public abstract Date engineGetCreationDate(String alias); public abstract Date engineGetCreationDate(String alias);
...@@ -95,8 +90,7 @@ public abstract class KeyStoreSpi { ...@@ -95,8 +90,7 @@ public abstract class KeyStoreSpi {
* Associates the given alias with the key, password and certificate chain. * Associates the given alias with the key, password and certificate chain.
* <p> * <p>
* If the specified alias already exists, it will be reassigned. * If the specified alias already exists, it will be reassigned.
* </p> *
*
* @param alias * @param alias
* the alias for the key. * the alias for the key.
* @param key * @param key
...@@ -111,7 +105,6 @@ public abstract class KeyStoreSpi { ...@@ -111,7 +105,6 @@ public abstract class KeyStoreSpi {
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if {@code key} is a {@code PrivateKey} and {@code chain} does * if {@code key} is a {@code PrivateKey} and {@code chain} does
* not contain any certificates. * not contain any certificates.
* @since Android 1.0
*/ */
public abstract void engineSetKeyEntry(String alias, Key key, public abstract void engineSetKeyEntry(String alias, Key key,
char[] password, Certificate[] chain) throws KeyStoreException; char[] password, Certificate[] chain) throws KeyStoreException;
...@@ -120,8 +113,7 @@ public abstract class KeyStoreSpi { ...@@ -120,8 +113,7 @@ public abstract class KeyStoreSpi {
* Associates the given alias with a key and a certificate chain. * Associates the given alias with a key and a certificate chain.
* <p> * <p>
* If the specified alias already exists, it will be reassigned. * If the specified alias already exists, it will be reassigned.
* </p> *
*
* @param alias * @param alias
* the alias for the key. * the alias for the key.
* @param key * @param key
...@@ -133,7 +125,6 @@ public abstract class KeyStoreSpi { ...@@ -133,7 +125,6 @@ public abstract class KeyStoreSpi {
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if {@code key} is a {@code PrivateKey} and {@code chain} * if {@code key} is a {@code PrivateKey} and {@code chain}
* does. * does.
* @since Android 1.0
*/ */
public abstract void engineSetKeyEntry(String alias, byte[] key, public abstract void engineSetKeyEntry(String alias, byte[] key,
Certificate[] chain) throws KeyStoreException; Certificate[] chain) throws KeyStoreException;
...@@ -142,8 +133,7 @@ public abstract class KeyStoreSpi { ...@@ -142,8 +133,7 @@ public abstract class KeyStoreSpi {
* Associates the given alias with a certificate. * Associates the given alias with a certificate.
* <p> * <p>
* If the specified alias already exists, it will be reassigned. * If the specified alias already exists, it will be reassigned.
* </p> *
*
* @param alias * @param alias
* the alias for the certificate. * the alias for the certificate.
* @param cert * @param cert
...@@ -152,7 +142,6 @@ public abstract class KeyStoreSpi { ...@@ -152,7 +142,6 @@ public abstract class KeyStoreSpi {
* if an existing alias is not associated to an entry containing * if an existing alias is not associated to an entry containing
* a trusted certificate, or this method fails for any other * a trusted certificate, or this method fails for any other
* reason. * reason.
* @since Android 1.0
*/ */
public abstract void engineSetCertificateEntry(String alias, public abstract void engineSetCertificateEntry(String alias,
Certificate cert) throws KeyStoreException; Certificate cert) throws KeyStoreException;
...@@ -160,12 +149,11 @@ public abstract class KeyStoreSpi { ...@@ -160,12 +149,11 @@ public abstract class KeyStoreSpi {
/** /**
* Deletes the entry identified with the given alias from this {@code * Deletes the entry identified with the given alias from this {@code
* KeyStoreSpi}. * KeyStoreSpi}.
* *
* @param alias * @param alias
* the alias for the entry. * the alias for the entry.
* @throws KeyStoreException * @throws KeyStoreException
* if the entry can not be deleted. * if the entry can not be deleted.
* @since Android 1.0
*/ */
public abstract void engineDeleteEntry(String alias) public abstract void engineDeleteEntry(String alias)
throws KeyStoreException; throws KeyStoreException;
...@@ -173,63 +161,57 @@ public abstract class KeyStoreSpi { ...@@ -173,63 +161,57 @@ public abstract class KeyStoreSpi {
/** /**
* Returns an {@code Enumeration} over all alias names stored in this * Returns an {@code Enumeration} over all alias names stored in this
* {@code KeyStoreSpi}. * {@code KeyStoreSpi}.
* *
* @return an {@code Enumeration} over all alias names stored in this * @return an {@code Enumeration} over all alias names stored in this
* {@code KeyStoreSpi}. * {@code KeyStoreSpi}.
* @since Android 1.0
*/ */
public abstract Enumeration<String> engineAliases(); public abstract Enumeration<String> engineAliases();
/** /**
* Indicates whether the given alias is present in this {@code KeyStoreSpi}. * Indicates whether the given alias is present in this {@code KeyStoreSpi}.
* *
* @param alias * @param alias
* the alias of an entry. * the alias of an entry.
* @return {@code true} if the alias exists, {@code false} otherwise. * @return {@code true} if the alias exists, {@code false} otherwise.
* @since Android 1.0
*/ */
public abstract boolean engineContainsAlias(String alias); public abstract boolean engineContainsAlias(String alias);
/** /**
* Returns the number of entries stored in this {@code KeyStoreSpi}. * Returns the number of entries stored in this {@code KeyStoreSpi}.
* *
* @return the number of entries stored in this {@code KeyStoreSpi}. * @return the number of entries stored in this {@code KeyStoreSpi}.
* @since Android 1.0
*/ */
public abstract int engineSize(); public abstract int engineSize();
/** /**
* Indicates whether the specified alias is associated with either a * Indicates whether the specified alias is associated with either a
* {@link KeyStore.PrivateKeyEntry} or a {@link KeyStore.SecretKeyEntry}. * {@link KeyStore.PrivateKeyEntry} or a {@link KeyStore.SecretKeyEntry}.
* *
* @param alias * @param alias
* the alias of an entry. * the alias of an entry.
* @return {@code true} if the given alias is associated with a key entry. * @return {@code true} if the given alias is associated with a key entry.
* @since Android 1.0
*/ */
public abstract boolean engineIsKeyEntry(String alias); public abstract boolean engineIsKeyEntry(String alias);
/** /**
* Indicates whether the specified alias is associated with a * Indicates whether the specified alias is associated with a
* {@link KeyStore.TrustedCertificateEntry}. * {@link KeyStore.TrustedCertificateEntry}.
* *
* @param alias * @param alias
* the alias of an entry. * the alias of an entry.
* @return {@code true} if the given alias is associated with a certificate * @return {@code true} if the given alias is associated with a certificate
* entry. * entry.
* @since Android 1.0
*/ */
public abstract boolean engineIsCertificateEntry(String alias); public abstract boolean engineIsCertificateEntry(String alias);
/** /**
* Returns the alias associated with the first entry whose certificate * Returns the alias associated with the first entry whose certificate
* matches the specified certificate. * matches the specified certificate.
* *
* @param cert * @param cert
* the certificate to find the associated entry's alias for. * the certificate to find the associated entry's alias for.
* @return the alias or {@code null} if no entry with the specified * @return the alias or {@code null} if no entry with the specified
* certificate can be found. * certificate can be found.
* @since Android 1.0
*/ */
public abstract String engineGetCertificateAlias(Certificate cert); public abstract String engineGetCertificateAlias(Certificate cert);
...@@ -237,7 +219,7 @@ public abstract class KeyStoreSpi { ...@@ -237,7 +219,7 @@ public abstract class KeyStoreSpi {
* Writes this {@code KeyStoreSpi} to the specified {@code OutputStream}. * Writes this {@code KeyStoreSpi} to the specified {@code OutputStream}.
* The data written to the {@code OutputStream} is protected by the * The data written to the {@code OutputStream} is protected by the
* specified password. * specified password.
* *
* @param stream * @param stream
* the {@code OutputStream} to write the store's data to. * the {@code OutputStream} to write the store's data to.
* @param password * @param password
...@@ -249,7 +231,6 @@ public abstract class KeyStoreSpi { ...@@ -249,7 +231,6 @@ public abstract class KeyStoreSpi {
* @throws CertificateException * @throws CertificateException
* if the an exception occurred while storing the certificates * if the an exception occurred while storing the certificates
* of this code {@code KeyStoreSpi}. * of this code {@code KeyStoreSpi}.
* @since Android 1.0
*/ */
public abstract void engineStore(OutputStream stream, char[] password) public abstract void engineStore(OutputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException; throws IOException, NoSuchAlgorithmException, CertificateException;
...@@ -257,7 +238,7 @@ public abstract class KeyStoreSpi { ...@@ -257,7 +238,7 @@ public abstract class KeyStoreSpi {
/** /**
* Stores this {@code KeyStoreSpi} using the specified {@code * Stores this {@code KeyStoreSpi} using the specified {@code
* LoadStoreParameter}. * LoadStoreParameter}.
* *
* @param param * @param param
* the {@code LoadStoreParameter} that specifies how to store * the {@code LoadStoreParameter} that specifies how to store
* this {@code KeyStoreSpi}, maybe {@code null}. * this {@code KeyStoreSpi}, maybe {@code null}.
...@@ -271,7 +252,6 @@ public abstract class KeyStoreSpi { ...@@ -271,7 +252,6 @@ public abstract class KeyStoreSpi {
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if the given {@link KeyStore.LoadStoreParameter} is not * if the given {@link KeyStore.LoadStoreParameter} is not
* recognized. * recognized.
* @since Android 1.0
*/ */
public void engineStore(KeyStore.LoadStoreParameter param) public void engineStore(KeyStore.LoadStoreParameter param)
throws IOException, NoSuchAlgorithmException, CertificateException { throws IOException, NoSuchAlgorithmException, CertificateException {
...@@ -281,7 +261,7 @@ public abstract class KeyStoreSpi { ...@@ -281,7 +261,7 @@ public abstract class KeyStoreSpi {
/** /**
* Loads this {@code KeyStoreSpi} from the given {@code InputStream}. * Loads this {@code KeyStoreSpi} from the given {@code InputStream}.
* Utilizes the given password to verify the stored data. * Utilizes the given password to verify the stored data.
* *
* @param stream * @param stream
* the {@code InputStream} to load this {@code KeyStoreSpi}'s * the {@code InputStream} to load this {@code KeyStoreSpi}'s
* data from. * data from.
...@@ -294,7 +274,6 @@ public abstract class KeyStoreSpi { ...@@ -294,7 +274,6 @@ public abstract class KeyStoreSpi {
* @throws CertificateException * @throws CertificateException
* if the an exception occurred while loading the certificates * if the an exception occurred while loading the certificates
* of this code {@code KeyStoreSpi}. * of this code {@code KeyStoreSpi}.
* @since Android 1.0
*/ */
public abstract void engineLoad(InputStream stream, char[] password) public abstract void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException; throws IOException, NoSuchAlgorithmException, CertificateException;
...@@ -302,7 +281,7 @@ public abstract class KeyStoreSpi { ...@@ -302,7 +281,7 @@ public abstract class KeyStoreSpi {
/** /**
* Loads this {@code KeyStoreSpi} using the specified {@code * Loads this {@code KeyStoreSpi} using the specified {@code
* LoadStoreParameter}. * LoadStoreParameter}.
* *
* @param param * @param param
* the {@code LoadStoreParameter} that specifies how to load this * the {@code LoadStoreParameter} that specifies how to load this
* {@code KeyStoreSpi}, maybe {@code null}. * {@code KeyStoreSpi}, maybe {@code null}.
...@@ -316,7 +295,6 @@ public abstract class KeyStoreSpi { ...@@ -316,7 +295,6 @@ public abstract class KeyStoreSpi {
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if the given {@link KeyStore.LoadStoreParameter} is not * if the given {@link KeyStore.LoadStoreParameter} is not
* recognized. * recognized.
* @since Android 1.0
*/ */
public void engineLoad(KeyStore.LoadStoreParameter param) public void engineLoad(KeyStore.LoadStoreParameter param)
throws IOException, NoSuchAlgorithmException, CertificateException { throws IOException, NoSuchAlgorithmException, CertificateException {
...@@ -351,7 +329,7 @@ public abstract class KeyStoreSpi { ...@@ -351,7 +329,7 @@ public abstract class KeyStoreSpi {
/** /**
* Returns the {@code Entry} with the given alias, using the specified * Returns the {@code Entry} with the given alias, using the specified
* {@code ProtectionParameter}. * {@code ProtectionParameter}.
* *
* @param alias * @param alias
* the alias of the requested entry. * the alias of the requested entry.
* @param protParam * @param protParam
...@@ -365,7 +343,6 @@ public abstract class KeyStoreSpi { ...@@ -365,7 +343,6 @@ public abstract class KeyStoreSpi {
* if the entry can not be recovered. * if the entry can not be recovered.
* @throws KeyStoreException * @throws KeyStoreException
* if this operation fails * if this operation fails
* @since Android 1.0
*/ */
public KeyStore.Entry engineGetEntry(String alias, public KeyStore.Entry engineGetEntry(String alias,
KeyStore.ProtectionParameter protParam) throws KeyStoreException, KeyStore.ProtectionParameter protParam) throws KeyStoreException,
...@@ -417,8 +394,7 @@ public abstract class KeyStoreSpi { ...@@ -417,8 +394,7 @@ public abstract class KeyStoreSpi {
* specified {@code ProtectionParameter}. * specified {@code ProtectionParameter}.
* <p> * <p>
* If the specified alias already exists, it will be reassigned. * If the specified alias already exists, it will be reassigned.
* </p> *
*
* @param alias * @param alias
* the alias for the entry. * the alias for the entry.
* @param entry * @param entry
...@@ -427,7 +403,6 @@ public abstract class KeyStoreSpi { ...@@ -427,7 +403,6 @@ public abstract class KeyStoreSpi {
* the {@code ProtectionParameter} to protect the entry. * the {@code ProtectionParameter} to protect the entry.
* @throws KeyStoreException * @throws KeyStoreException
* if this operation fails. * if this operation fails.
* @since Android 1.0
*/ */
public void engineSetEntry(String alias, KeyStore.Entry entry, public void engineSetEntry(String alias, KeyStore.Entry entry,
KeyStore.ProtectionParameter protParam) throws KeyStoreException { KeyStore.ProtectionParameter protParam) throws KeyStoreException {
...@@ -486,14 +461,13 @@ public abstract class KeyStoreSpi { ...@@ -486,14 +461,13 @@ public abstract class KeyStoreSpi {
/** /**
* Indicates whether the entry for the given alias is assignable to the * Indicates whether the entry for the given alias is assignable to the
* provided {@code Class}. * provided {@code Class}.
* *
* @param alias * @param alias
* the alias for the entry. * the alias for the entry.
* @param entryClass * @param entryClass
* the type of the entry. * the type of the entry.
* @return {@code true} if the {@code Entry} for the alias is assignable to * @return {@code true} if the {@code Entry} for the alias is assignable to
* the specified {@code entryClass}. * the specified {@code entryClass}.
* @since Android 1.0
*/ */
public boolean engineEntryInstanceOf(String alias, public boolean engineEntryInstanceOf(String alias,
Class<? extends KeyStore.Entry> entryClass) { Class<? extends KeyStore.Entry> entryClass) {
......
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Boris V. Kuznetsov
* @version $Revision$
*/
package java.security; package java.security;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
...@@ -31,12 +26,11 @@ import org.apache.harmony.security.internal.nls.Messages; ...@@ -31,12 +26,11 @@ import org.apache.harmony.security.internal.nls.Messages;
* {@code MessageDigest} is an engine class which is capable of generating one * {@code MessageDigest} is an engine class which is capable of generating one
* way hash values for arbitrary input, utilizing the algorithm it was * way hash values for arbitrary input, utilizing the algorithm it was
* initialized with. * initialized with.
* *
* @see MessageDigestSpi * @see MessageDigestSpi
* @since Android 1.0
*/ */
public abstract class MessageDigest extends MessageDigestSpi { public abstract class MessageDigest extends MessageDigestSpi {
// The service name // The service name
private static final String SERVICE = "MessageDigest"; //$NON-NLS-1$ private static final String SERVICE = "MessageDigest"; //$NON-NLS-1$
...@@ -55,7 +49,6 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -55,7 +49,6 @@ public abstract class MessageDigest extends MessageDigestSpi {
* *
* @param algorithm * @param algorithm
* the name of algorithm to use * the name of algorithm to use
* @since Android 1.0
*/ */
protected MessageDigest(String algorithm) { protected MessageDigest(String algorithm) {
this.algorithm = algorithm; this.algorithm = algorithm;
...@@ -73,7 +66,6 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -73,7 +66,6 @@ public abstract class MessageDigest extends MessageDigestSpi {
* if the specified algorithm is not available * if the specified algorithm is not available
* @throws NullPointerException * @throws NullPointerException
* if {@code algorithm} is {@code null} * if {@code algorithm} is {@code null}
* @since Android 1.0
*/ */
public static MessageDigest getInstance(String algorithm) public static MessageDigest getInstance(String algorithm)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
...@@ -88,11 +80,9 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -88,11 +80,9 @@ public abstract class MessageDigest extends MessageDigestSpi {
result.algorithm = algorithm; result.algorithm = algorithm;
result.provider = engine.provider; result.provider = engine.provider;
return result; return result;
} else {
result = new MessageDigestImpl((MessageDigestSpi) engine.spi,
engine.provider, algorithm);
return result;
} }
return new MessageDigestImpl((MessageDigestSpi) engine.spi,
engine.provider, algorithm);
} }
} }
...@@ -112,16 +102,17 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -112,16 +102,17 @@ public abstract class MessageDigest extends MessageDigestSpi {
* if the specified provider is not available * if the specified provider is not available
* @throws NullPointerException * @throws NullPointerException
* if {@code algorithm} is {@code null} * if {@code algorithm} is {@code null}
* @since Android 1.0
*/ */
public static MessageDigest getInstance(String algorithm, String provider) public static MessageDigest getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException { throws NoSuchAlgorithmException, NoSuchProviderException {
if ((provider == null) || (provider.length() == 0)) { if ((provider == null) || (provider.length() == 0)) {
throw new IllegalArgumentException(Messages.getString("security.02")); //$NON-NLS-1$ throw new IllegalArgumentException(Messages
.getString("security.02")); //$NON-NLS-1$
} }
Provider p = Security.getProvider(provider); Provider p = Security.getProvider(provider);
if (p == null) { if (p == null) {
throw new NoSuchProviderException(Messages.getString("security.03", provider)); //$NON-NLS-1$ throw new NoSuchProviderException(Messages.getString(
"security.03", provider)); //$NON-NLS-1$
} }
return getInstance(algorithm, p); return getInstance(algorithm, p);
} }
...@@ -140,12 +131,12 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -140,12 +131,12 @@ public abstract class MessageDigest extends MessageDigestSpi {
* if the specified algorithm is not available * if the specified algorithm is not available
* @throws NullPointerException * @throws NullPointerException
* if {@code algorithm} is {@code null} * if {@code algorithm} is {@code null}
* @since Android 1.0
*/ */
public static MessageDigest getInstance(String algorithm, Provider provider) public static MessageDigest getInstance(String algorithm, Provider provider)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
if (provider == null) { if (provider == null) {
throw new IllegalArgumentException(Messages.getString("security.04")); //$NON-NLS-1$ throw new IllegalArgumentException(Messages
.getString("security.04")); //$NON-NLS-1$
} }
if (algorithm == null) { if (algorithm == null) {
throw new NullPointerException(Messages.getString("security.01")); //$NON-NLS-1$ throw new NullPointerException(Messages.getString("security.01")); //$NON-NLS-1$
...@@ -158,19 +149,16 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -158,19 +149,16 @@ public abstract class MessageDigest extends MessageDigestSpi {
result.algorithm = algorithm; result.algorithm = algorithm;
result.provider = provider; result.provider = provider;
return result; return result;
} else {
result = new MessageDigestImpl((MessageDigestSpi) engine.spi,
provider, algorithm);
return result;
} }
result = new MessageDigestImpl((MessageDigestSpi) engine.spi,
provider, algorithm);
return result;
} }
} }
/** /**
* Puts this {@code MessageDigest} back in an initial state, such that it is * Puts this {@code MessageDigest} back in an initial state, such that it is
* ready to compute a one way hash value. * ready to compute a one way hash value.
*
* @since Android 1.0
*/ */
public void reset() { public void reset() {
engineReset(); engineReset();
...@@ -200,11 +188,10 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -200,11 +188,10 @@ public abstract class MessageDigest extends MessageDigestSpi {
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if {@code offset} or {@code len} are not valid in respect to * if {@code offset} or {@code len} are not valid in respect to
* {@code input} * {@code input}
* @since Android 1.0
*/ */
public void update(byte[] input, int offset, int len) { public void update(byte[] input, int offset, int len) {
if (input == null || if (input == null ||
// offset < 0 || len < 0 || // offset < 0 || len < 0 ||
// checks for negative values are commented out intentionally // checks for negative values are commented out intentionally
// see HARMONY-1120 for details // see HARMONY-1120 for details
(long) offset + (long) len > input.length) { (long) offset + (long) len > input.length) {
...@@ -221,7 +208,6 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -221,7 +208,6 @@ public abstract class MessageDigest extends MessageDigestSpi {
* the {@code byte} array * the {@code byte} array
* @throws NullPointerException * @throws NullPointerException
* if {@code input} is {@code null} * if {@code input} is {@code null}
* @since Android 1.0
*/ */
public void update(byte[] input) { public void update(byte[] input) {
if (input == null) { if (input == null) {
...@@ -259,11 +245,10 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -259,11 +245,10 @@ public abstract class MessageDigest extends MessageDigestSpi {
* if {@code offset} or {@code len} are not valid in respect to * if {@code offset} or {@code len} are not valid in respect to
* {@code buf} * {@code buf}
* @see #reset() * @see #reset()
* @since Android 1.0
*/ */
public int digest(byte[] buf, int offset, int len) throws DigestException { public int digest(byte[] buf, int offset, int len) throws DigestException {
if (buf == null || if (buf == null ||
// offset < 0 || len < 0 || // offset < 0 || len < 0 ||
// checks for negative values are commented out intentionally // checks for negative values are commented out intentionally
// see HARMONY-1148 for details // see HARMONY-1148 for details
(long) offset + (long) len > buf.length) { (long) offset + (long) len > buf.length) {
...@@ -282,7 +267,6 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -282,7 +267,6 @@ public abstract class MessageDigest extends MessageDigestSpi {
* the {@code byte} array * the {@code byte} array
* @return the computed one way hash value * @return the computed one way hash value
* @see #reset() * @see #reset()
* @since Android 1.0
*/ */
public byte[] digest(byte[] input) { public byte[] digest(byte[] input) {
update(input); update(input);
...@@ -294,8 +278,8 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -294,8 +278,8 @@ public abstract class MessageDigest extends MessageDigestSpi {
* {@code MessageDigest} including the name of its algorithm. * {@code MessageDigest} including the name of its algorithm.
* *
* @return a printable representation for this {@code MessageDigest} * @return a printable representation for this {@code MessageDigest}
* @since Android 1.0
*/ */
@Override
public String toString() { public String toString() {
return "MESSAGE DIGEST " + algorithm; //$NON-NLS-1$ return "MESSAGE DIGEST " + algorithm; //$NON-NLS-1$
} }
...@@ -309,7 +293,6 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -309,7 +293,6 @@ public abstract class MessageDigest extends MessageDigestSpi {
* @param digestb * @param digestb
* the second digest to be compared * the second digest to be compared
* @return {@code true} if the two hashes are equal, {@code false} otherwise * @return {@code true} if the two hashes are equal, {@code false} otherwise
* @since Android 1.0
*/ */
public static boolean isEqual(byte[] digesta, byte[] digestb) { public static boolean isEqual(byte[] digesta, byte[] digestb) {
if (digesta.length != digestb.length) { if (digesta.length != digestb.length) {
...@@ -327,7 +310,6 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -327,7 +310,6 @@ public abstract class MessageDigest extends MessageDigestSpi {
* Returns the name of the algorithm of this {@code MessageDigest}. * Returns the name of the algorithm of this {@code MessageDigest}.
* *
* @return the name of the algorithm of this {@code MessageDigest} * @return the name of the algorithm of this {@code MessageDigest}
* @since Android 1.0
*/ */
public final String getAlgorithm() { public final String getAlgorithm() {
return algorithm; return algorithm;
...@@ -337,7 +319,6 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -337,7 +319,6 @@ public abstract class MessageDigest extends MessageDigestSpi {
* Returns the provider associated with this {@code MessageDigest}. * Returns the provider associated with this {@code MessageDigest}.
* *
* @return the provider associated with this {@code MessageDigest} * @return the provider associated with this {@code MessageDigest}
* @since Android 1.0
*/ */
public final Provider getProvider() { public final Provider getProvider() {
return provider; return provider;
...@@ -349,7 +330,6 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -349,7 +330,6 @@ public abstract class MessageDigest extends MessageDigestSpi {
* {@code 0} is returned. * {@code 0} is returned.
* *
* @return the digest length in bytes, or {@code 0} * @return the digest length in bytes, or {@code 0}
* @since Android 1.0
*/ */
public final int getDigestLength() { public final int getDigestLength() {
int l = engineGetDigestLength(); int l = engineGetDigestLength();
...@@ -367,12 +347,12 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -367,12 +347,12 @@ public abstract class MessageDigest extends MessageDigestSpi {
} }
} }
@Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) { if (this instanceof Cloneable) {
return super.clone(); return super.clone();
} else {
throw new CloneNotSupportedException();
} }
throw new CloneNotSupportedException();
} }
/** /**
...@@ -380,7 +360,6 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -380,7 +360,6 @@ public abstract class MessageDigest extends MessageDigestSpi {
* *
* @param input * @param input
* the {@code ByteBuffer} * the {@code ByteBuffer}
* @since Android 1.0
*/ */
public final void update(ByteBuffer input) { public final void update(ByteBuffer input) {
engineUpdate(input); engineUpdate(input);
...@@ -392,7 +371,7 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -392,7 +371,7 @@ public abstract class MessageDigest extends MessageDigestSpi {
* *
*/ */
private static class MessageDigestImpl extends MessageDigest { private static class MessageDigestImpl extends MessageDigest {
// MessageDigestSpi implementation // MessageDigestSpi implementation
private MessageDigestSpi spiImpl; private MessageDigestSpi spiImpl;
...@@ -405,38 +384,44 @@ public abstract class MessageDigest extends MessageDigestSpi { ...@@ -405,38 +384,44 @@ public abstract class MessageDigest extends MessageDigestSpi {
} }
// engineReset() implementation // engineReset() implementation
@Override
protected void engineReset() { protected void engineReset() {
spiImpl.engineReset(); spiImpl.engineReset();
} }
// engineDigest() implementation // engineDigest() implementation
@Override
protected byte[] engineDigest() { protected byte[] engineDigest() {
return spiImpl.engineDigest(); return spiImpl.engineDigest();
} }
// engineGetDigestLength() implementation // engineGetDigestLength() implementation
@Override
protected int engineGetDigestLength() { protected int engineGetDigestLength() {
return spiImpl.engineGetDigestLength(); return spiImpl.engineGetDigestLength();
} }
// engineUpdate() implementation // engineUpdate() implementation
@Override
protected void engineUpdate(byte arg0) { protected void engineUpdate(byte arg0) {
spiImpl.engineUpdate(arg0); spiImpl.engineUpdate(arg0);
} }
// engineUpdate() implementation // engineUpdate() implementation
@Override
protected void engineUpdate(byte[] arg0, int arg1, int arg2) { protected void engineUpdate(byte[] arg0, int arg1, int arg2) {
spiImpl.engineUpdate(arg0, arg1, arg2); spiImpl.engineUpdate(arg0, arg1, arg2);
} }
// Returns a clone if the spiImpl is cloneable // Returns a clone if the spiImpl is cloneable
@Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
if (spiImpl instanceof Cloneable) { if (spiImpl instanceof Cloneable) {
MessageDigestSpi spi = (MessageDigestSpi) spiImpl.clone(); MessageDigestSpi spi = (MessageDigestSpi) spiImpl.clone();
return new MessageDigestImpl(spi, getProvider(), getAlgorithm()); return new MessageDigestImpl(spi, getProvider(), getAlgorithm());
} else {
throw new CloneNotSupportedException();
} }
throw new CloneNotSupportedException();
} }
} }
} }
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Boris V. Kuznetsov
* @version $Revision$
*/
package java.security; package java.security;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
...@@ -33,7 +28,6 @@ import org.apache.harmony.security.internal.nls.Messages; ...@@ -33,7 +28,6 @@ import org.apache.harmony.security.internal.nls.Messages;
* a fingerprint for a stream of bytes. * a fingerprint for a stream of bytes.
* *
* @see MessageDigest * @see MessageDigest
* @since Android 1.0
*/ */
public abstract class MessageDigestSpi { public abstract class MessageDigestSpi {
...@@ -42,7 +36,6 @@ public abstract class MessageDigestSpi { ...@@ -42,7 +36,6 @@ public abstract class MessageDigestSpi {
* implement this function {@code 0} is returned. * implement this function {@code 0} is returned.
* *
* @return the digest length in bytes, or {@code 0}. * @return the digest length in bytes, or {@code 0}.
* @since Android 1.0
*/ */
protected int engineGetDigestLength() { protected int engineGetDigestLength() {
return 0; return 0;
...@@ -54,10 +47,9 @@ public abstract class MessageDigestSpi { ...@@ -54,10 +47,9 @@ public abstract class MessageDigestSpi {
* @param input * @param input
* the {@code byte} to update this {@code MessageDigestSpi} with. * the {@code byte} to update this {@code MessageDigestSpi} with.
* @see #engineReset() * @see #engineReset()
* @since Android 1.0
*/ */
protected abstract void engineUpdate(byte input); protected abstract void engineUpdate(byte input);
/** /**
* Updates this {@code MessageDigestSpi} using the given {@code byte[]}. * Updates this {@code MessageDigestSpi} using the given {@code byte[]}.
* *
...@@ -70,7 +62,6 @@ public abstract class MessageDigestSpi { ...@@ -70,7 +62,6 @@ public abstract class MessageDigestSpi {
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if {@code offset} or {@code len} are not valid in respect to * if {@code offset} or {@code len} are not valid in respect to
* {@code input}. * {@code input}.
* @since Android 1.0
*/ */
protected abstract void engineUpdate(byte[] input, int offset, int len); protected abstract void engineUpdate(byte[] input, int offset, int len);
...@@ -79,7 +70,6 @@ public abstract class MessageDigestSpi { ...@@ -79,7 +70,6 @@ public abstract class MessageDigestSpi {
* *
* @param input * @param input
* the {@code ByteBuffer}. * the {@code ByteBuffer}.
* @since Android 1.0
*/ */
protected void engineUpdate(ByteBuffer input) { protected void engineUpdate(ByteBuffer input) {
if (!input.hasRemaining()) { if (!input.hasRemaining()) {
...@@ -107,7 +97,6 @@ public abstract class MessageDigestSpi { ...@@ -107,7 +97,6 @@ public abstract class MessageDigestSpi {
* *
* @return the computed one way hash value. * @return the computed one way hash value.
* @see #engineReset() * @see #engineReset()
* @since Android 1.0
*/ */
protected abstract byte[] engineDigest(); protected abstract byte[] engineDigest();
...@@ -129,7 +118,6 @@ public abstract class MessageDigestSpi { ...@@ -129,7 +118,6 @@ public abstract class MessageDigestSpi {
* if {@code offset} or {@code len} are not valid in respect to * if {@code offset} or {@code len} are not valid in respect to
* {@code buf}. * {@code buf}.
* @see #engineReset() * @see #engineReset()
* @since Android 1.0
*/ */
protected int engineDigest(byte[] buf, int offset, int len) protected int engineDigest(byte[] buf, int offset, int len)
throws DigestException { throws DigestException {
...@@ -156,11 +144,10 @@ public abstract class MessageDigestSpi { ...@@ -156,11 +144,10 @@ public abstract class MessageDigestSpi {
/** /**
* Puts this {@code MessageDigestSpi} back in an initial state, such that it * Puts this {@code MessageDigestSpi} back in an initial state, such that it
* is ready to compute a one way hash value. * is ready to compute a one way hash value.
*
* @since Android 1.0
*/ */
protected abstract void engineReset(); protected abstract void engineReset();
@Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
return super.clone(); return super.clone();
} }
......
...@@ -15,18 +15,11 @@ ...@@ -15,18 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @author Vera Y. Petrashkova
* @version $Revision$
*/
package java.security; package java.security;
/** /**
* {@code NoSuchAlgorithmException} indicates that a requested algorithm could * {@code NoSuchAlgorithmException} indicates that a requested algorithm could
* not be found. * not be found.
*
* @since Android 1.0
*/ */
public class NoSuchAlgorithmException extends GeneralSecurityException { public class NoSuchAlgorithmException extends GeneralSecurityException {
...@@ -35,10 +28,9 @@ public class NoSuchAlgorithmException extends GeneralSecurityException { ...@@ -35,10 +28,9 @@ public class NoSuchAlgorithmException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code NoSuchAlgorithmException} with the * Constructs a new instance of {@code NoSuchAlgorithmException} with the
* given message. * given message.
* *
* @param msg * @param msg
* the detail message for this exception. * the detail message for this exception.
* @since Android 1.0
*/ */
public NoSuchAlgorithmException(String msg) { public NoSuchAlgorithmException(String msg) {
super(msg); super(msg);
...@@ -46,8 +38,6 @@ public class NoSuchAlgorithmException extends GeneralSecurityException { ...@@ -46,8 +38,6 @@ public class NoSuchAlgorithmException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code NoSuchAlgorithmException}. * Constructs a new instance of {@code NoSuchAlgorithmException}.
*
* @since Android 1.0
*/ */
public NoSuchAlgorithmException() { public NoSuchAlgorithmException() {
} }
...@@ -55,12 +45,11 @@ public class NoSuchAlgorithmException extends GeneralSecurityException { ...@@ -55,12 +45,11 @@ public class NoSuchAlgorithmException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code NoSuchAlgorithmException} with the * Constructs a new instance of {@code NoSuchAlgorithmException} with the
* given message and the cause. * given message and the cause.
* *
* @param message * @param message
* the detail message for this exception. * the detail message for this exception.
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public NoSuchAlgorithmException(String message, Throwable cause) { public NoSuchAlgorithmException(String message, Throwable cause) {
super(message, cause); super(message, cause);
...@@ -69,10 +58,9 @@ public class NoSuchAlgorithmException extends GeneralSecurityException { ...@@ -69,10 +58,9 @@ public class NoSuchAlgorithmException extends GeneralSecurityException {
/** /**
* Constructs a new instance of {@code NoSuchAlgorithmException} with the * Constructs a new instance of {@code NoSuchAlgorithmException} with the
* cause. * cause.
* *
* @param cause * @param cause
* the exception which is the cause for this exception. * the exception which is the cause for this exception.
* @since Android 1.0
*/ */
public NoSuchAlgorithmException(Throwable cause) { public NoSuchAlgorithmException(Throwable cause) {
super(cause); super(cause);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment