FileDocCategorySizeDatePackage
Signer.javaAPI DocJava SE 5 API4509Fri Aug 26 14:57:16 BST 2005java.security

Signer

public abstract class Signer extends Identity
This class is used to represent an Identity that can also digitally sign data.

The management of a signer's private keys is an important and sensitive issue that should be handled by subclasses as appropriate to their intended use.

see
Identity
version
1.42 04/05/18
author
Benjamin Renaud
deprecated
This class is no longer used. Its functionality has been replaced by java.security.KeyStore, the java.security.cert package, and java.security.Principal.

Fields Summary
private static final long
serialVersionUID
private PrivateKey
privateKey
The signer's private key.
Constructors Summary
protected Signer()
Creates a signer. This constructor should only be used for serialization.


                    
      
	super();
    
public Signer(String name)
Creates a signer with the specified identity name.

param
name the identity name.

	super(name);
    
public Signer(String name, IdentityScope scope)
Creates a signer with the specified identity name and scope.

param
name the identity name.
param
scope the scope of the identity.
exception
KeyManagementException if there is already an identity with the same name in the scope.

	super(name, scope);
    
Methods Summary
private static voidcheck(java.lang.String directive)

	SecurityManager security = System.getSecurityManager();
	if (security != null) {
	    security.checkSecurityAccess(directive);
	}
    
public java.security.PrivateKeygetPrivateKey()
Returns this signer's private key.

First, if there is a security manager, its checkSecurityAccess method is called with "getSignerPrivateKey" as its argument to see if it's ok to return the private key.

return
this signer's private key, or null if the private key has not yet been set.
exception
SecurityException if a security manager exists and its checkSecurityAccess method doesn't allow returning the private key.
see
SecurityManager#checkSecurityAccess

	check("getSignerPrivateKey");
	return privateKey;
    
java.lang.StringprintKeys()

	String keys = "";
	PublicKey publicKey = getPublicKey();
	if (publicKey != null && privateKey != null) {
	    keys = "\tpublic and private keys initialized";

	} else {
	    keys = "\tno keys";
	}
	return keys;
    
public final voidsetKeyPair(java.security.KeyPair pair)
Sets the key pair (public key and private key) for this signer.

First, if there is a security manager, its checkSecurityAccess method is called with "setSignerKeyPair" as its argument to see if it's ok to set the key pair.

param
pair an initialized key pair.
exception
InvalidParameterException if the key pair is not properly initialized.
exception
KeyException if the key pair cannot be set for any other reason.
exception
SecurityException if a security manager exists and its checkSecurityAccess method doesn't allow setting the key pair.
see
SecurityManager#checkSecurityAccess

	check("setSignerKeyPair");
	final PublicKey pub = pair.getPublic();
	PrivateKey priv = pair.getPrivate();

	if (pub == null || priv == null) {
	    throw new InvalidParameterException();
	}
	try {
	    AccessController.doPrivileged(new PrivilegedExceptionAction() {
		public Object run() throws KeyManagementException {
		    setPublicKey(pub);
		    return null;
		}
	    });
	} catch (PrivilegedActionException pae) {
	    throw (KeyManagementException) pae.getException();
	}
	privateKey = priv;
    
public java.lang.StringtoString()
Returns a string of information about the signer.

return
a string of information about the signer.

	return "[Signer]" + super.toString();