2362N/A * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * <p>This class represents identities: real-world objects such as people, 0N/A * companies or organizations whose identities can be authenticated using 0N/A * their public keys. Identities may also be more abstract (or concrete) 0N/A * constructs, such as daemon threads or smart cards. 0N/A * <p>All Identity objects have a name and a public key. Names are 0N/A * immutable. Identities may also be scoped. That is, if an Identity is 0N/A * specified to have a particular scope, then the name and public 0N/A * key of the Identity are unique within that scope. 0N/A * <p>An Identity also has a set of certificates (all certifying its own 0N/A * public key). The Principal names specified in these certificates need 0N/A * not be the same, only the key. 0N/A * <p>An Identity can be subclassed, to include postal and email addresses, 0N/A * telephone numbers, images of faces and logos, and so on. 0N/A * @see IdentityScope 0N/A * @author Benjamin Renaud 0N/A * @deprecated This class is no longer used. Its functionality has been 0N/A * replaced by <code>java.security.KeyStore</code>, the 0N/A * <code>java.security.cert</code> package, and 0N/A * <code>java.security.Principal</code>. 0N/A /** use serialVersionUID from JDK 1.1.x for interoperability */ 0N/A * The name for this identity. 0N/A * The public key for this identity. 0N/A * Generic, descriptive information about the identity. 0N/A * The scope of the identity. 0N/A * The certificates for this identity. 0N/A * Constructor for serialization only. 0N/A this(
"restoring...");
0N/A * Constructs an identity with the specified name and scope. 0N/A * @param name the identity name. 0N/A * @param scope the scope of the identity. 0N/A * @exception KeyManagementException if there is already an identity 0N/A * with the same name in the scope. 0N/A * Constructs an identity with the specified name and no scope. 0N/A * @param name the identity name. 0N/A * Returns this identity's name. 0N/A * @return the name of this identity. 0N/A * Returns this identity's scope. 0N/A * @return the scope of this identity. 0N/A * Returns this identity's public key. 0N/A * @return the public key for this identity. 0N/A * @see #setPublicKey 0N/A * Sets this identity's public key. The old key and all of this 0N/A * identity's certificates are removed by this operation. 0N/A * <p>First, if there is a security manager, its <code>checkSecurityAccess</code> 0N/A * method is called with <code>"setIdentityPublicKey"</code> 0N/A * as its argument to see if it's ok to set the public key. 0N/A * @param key the public key for this identity. 0N/A * @exception KeyManagementException if another identity in the 0N/A * identity's scope has the same public key, or if another exception occurs. 0N/A * @exception SecurityException if a security manager exists and its 0N/A * <code>checkSecurityAccess</code> method doesn't allow 0N/A * setting the public key. 0N/A * @see #getPublicKey 0N/A * @see SecurityManager#checkSecurityAccess 0N/A /* Should we throw an exception if this is already set? */ 0N/A * Specifies a general information string for this identity. 0N/A * <p>First, if there is a security manager, its <code>checkSecurityAccess</code> 0N/A * method is called with <code>"setIdentityInfo"</code> 0N/A * as its argument to see if it's ok to specify the information string. 0N/A * @param info the information string. 0N/A * @exception SecurityException if a security manager exists and its 0N/A * <code>checkSecurityAccess</code> method doesn't allow 0N/A * setting the information string. 0N/A * @see SecurityManager#checkSecurityAccess 0N/A * Returns general information previously specified for this identity. 0N/A * @return general information about this identity. 0N/A * Adds a certificate for this identity. If the identity has a public 0N/A * key, the public key in the certificate must be the same, and if 0N/A * the identity does not have a public key, the identity's 0N/A * public key is set to be that specified in the certificate. 0N/A * <p>First, if there is a security manager, its <code>checkSecurityAccess</code> 0N/A * method is called with <code>"addIdentityCertificate"</code> 0N/A * as its argument to see if it's ok to add a certificate. 0N/A * @param certificate the certificate to be added. 0N/A * @exception KeyManagementException if the certificate is not valid, 0N/A * if the public key in the certificate being added conflicts with 0N/A * this identity's public key, or if another exception occurs. 0N/A * @exception SecurityException if a security manager exists and its 0N/A * <code>checkSecurityAccess</code> method doesn't allow 0N/A * adding a certificate. 0N/A * @see SecurityManager#checkSecurityAccess 0N/A "public key different from cert public key");
0N/A * Removes a certificate from this identity. 0N/A * <p>First, if there is a security manager, its <code>checkSecurityAccess</code> 0N/A * method is called with <code>"removeIdentityCertificate"</code> 0N/A * as its argument to see if it's ok to remove a certificate. 0N/A * @param certificate the certificate to be removed. 0N/A * @exception KeyManagementException if the certificate is 0N/A * missing, or if another exception occurs. 0N/A * @exception SecurityException if a security manager exists and its 0N/A * <code>checkSecurityAccess</code> method doesn't allow 0N/A * removing a certificate. 0N/A * @see SecurityManager#checkSecurityAccess 0N/A * Returns a copy of all the certificates for this identity. 0N/A * @return a copy of all the certificates for this identity. 0N/A * Tests for equality between the specified object and this identity. 0N/A * This first tests to see if the entities actually refer to the same 0N/A * object, in which case it returns true. Next, it checks to see if 0N/A * the entities have the same name and the same scope. If they do, 0N/A * the method returns true. Otherwise, it calls 0N/A * {@link #identityEquals(Identity) identityEquals}, which subclasses should 0N/A * @param identity the object to test for equality with this identity. 0N/A * @return true if the objects are considered equal, false otherwise. 0N/A * @see #identityEquals 0N/A * Tests for equality between the specified identity and this identity. 0N/A * This method should be overriden by subclasses to test for equality. 0N/A * The default behavior is to return true if the names and public keys 0N/A * @param identity the identity to test for equality with this identity. 0N/A * @return true if the identities are considered equal, false 0N/A * Returns a parsable name for identity: identityName.scopeName 0N/A * Returns a short string describing this identity, telling its 0N/A * name and its scope (if any). 0N/A * <p>First, if there is a security manager, its <code>checkSecurityAccess</code> 0N/A * method is called with <code>"printIdentity"</code> 0N/A * as its argument to see if it's ok to return the string. 0N/A * @return information about this identity, such as its name and the 0N/A * name of its scope (if any). 0N/A * @exception SecurityException if a security manager exists and its 0N/A * <code>checkSecurityAccess</code> method doesn't allow 0N/A * returning a string describing this identity. 0N/A * @see SecurityManager#checkSecurityAccess 0N/A * Returns a string representation of this identity, with 0N/A * optionally more details than that provided by the 0N/A * <code>toString</code> method without any arguments. 0N/A * <p>First, if there is a security manager, its <code>checkSecurityAccess</code> 0N/A * method is called with <code>"printIdentity"</code> 0N/A * as its argument to see if it's ok to return the string. 0N/A * @param detailed whether or not to provide detailed information. 0N/A * @return information about this identity. If <code>detailed</code> 0N/A * is true, then this method returns more information than that 0N/A * provided by the <code>toString</code> method without any arguments. 0N/A * @exception SecurityException if a security manager exists and its 0N/A * <code>checkSecurityAccess</code> method doesn't allow 0N/A * returning a string describing this identity. 0N/A * @see SecurityManager#checkSecurityAccess 0N/A out +=
"\n\tno additional information available.";
0N/A key =
"\tpublic key initialized";
0N/A return "\tno certificates";
0N/A out +=
"\tcertificate " + i++ +
0N/A * Returns a hashcode for this identity. 0N/A * @return a hashcode for this identity.