Methods Summary |
---|
private static void | check(java.lang.String directive)
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkSecurityAccess(directive);
}
|
public java.security.PrivateKey | getPrivateKey()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.
check("getSignerPrivateKey");
return privateKey;
|
java.lang.String | printKeys()
String keys = "";
PublicKey publicKey = getPublicKey();
if (publicKey != null && privateKey != null) {
keys = "\tpublic and private keys initialized";
} else {
keys = "\tno keys";
}
return keys;
|
public final void | setKeyPair(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.
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.String | toString()Returns a string of information about the signer.
return "[Signer]" + super.toString();
|