public abstract class Signer
extends Identity
| java.lang.Object | ||
| java.security.Identity | ||
| java.security.Signer | ||
此类已在API级别1中弃用。
这个类不再使用。 它的功能已经被替换为java.security.KeyStore ,该java.security.cert包, java.security.Principal 。
该类用于表示也可以对数据进行数字签名的标识。
签名者私钥的管理是一个重要而敏感的问题,应由子类根据其预期用途进行处理。
也可以看看:
Public constructors |
|
|---|---|
Signer(String name) 用指定的身份名称创建一个签名者。 |
|
Signer(String name, IdentityScope scope) 用指定的身份名称和范围创建一个签名者。 |
|
Protected constructors |
|
|---|---|
Signer() 创建一个签名者。 |
|
公共方法(Public methods) |
|
|---|---|
PrivateKey |
getPrivateKey() 返回此签名者的私钥。 |
final void |
setKeyPair(KeyPair pair) 为此签名者设置密钥对(公钥和私钥)。 |
String |
toString() 返回有关签名者的一串信息。 |
继承方法(Inherited methods) |
|
|---|---|
java.security.Identity
|
|
java.lang.Object
|
|
java.security.Principal
|
|
Signer (String name)
用指定的身份名称创建一个签名者。
| 参数(Parameters) | |
|---|---|
name |
String: the identity name. |
Signer (String name, IdentityScope scope)
用指定的身份名称和范围创建一个签名者。
| 参数(Parameters) | |
|---|---|
name |
String: the identity name. |
scope |
IdentityScope: the scope of the identity. |
| 抛出异常(Throws) | |
|---|---|
KeyManagementException |
if there is already an identity with the same name in the scope. |
PrivateKey getPrivateKey ()
返回此签名者的私钥。
首先,如果存在安全管理器, checkSecurityAccess使用 "getSignerPrivateKey"作为其参数来调用其 checkSecurityAccess方法,以查看是否可以返回私钥。
| 返回(Returns) | |
|---|---|
PrivateKey |
this signer's private key, or null if the private key has not yet been set. |
| 抛出异常(Throws) | |
|---|---|
SecurityException |
if a security manager exists and its checkSecurityAccess method doesn't allow returning the private key. |
也可以看看:
void setKeyPair (KeyPair pair)
为此签名者设置密钥对(公钥和私钥)。
首先,如果有安全管理器, checkSecurityAccess "setSignerKeyPair"作为参数调用其 checkSecurityAccess方法,以查看是否可以设置密钥对。
| 参数(Parameters) | |
|---|---|
pair |
KeyPair: an initialized key pair. |
| 抛出异常(Throws) | |
|---|---|
InvalidParameterException |
if the key pair is not properly initialized. |
KeyException |
if the key pair cannot be set for any other reason. |
SecurityException |
if a security manager exists and its checkSecurityAccess method doesn't allow setting the key pair. |
也可以看看:
String toString ()
返回有关签名者的一串信息。
| 返回(Returns) | |
|---|---|
String |
a string of information about the signer. |