- java.lang.Object
 -  
      
- java.security.Identity
 
 
-  
       
- 实现的所有接口
 -  
         
Serializable,Principal 
- 已知直接子类:
 -  
         
IdentityScope,Signer 
@Deprecated(since="1.2", forRemoval=true) public abstract class Identity extends Object implements Principal, Serializable
Deprecated, for removal: This API element is subject to removal in a future version.This class is deprecated and subject to removal in a future version of Java SE. It has been replaced byjava.security.KeyStore, thejava.security.certpackage, andjava.security.Principal.此类表示身份:真实世界的对象,例如人员,公司或组织,其身份可以使用其公钥进行身份验证。 身份也可能是更抽象(或具体)的结构,例如守护程序线程或智能卡。
所有Identity对象都有一个名称和一个公钥。 名称是不可变的。 身份也可以是范围的。 也就是说,如果指定Identity具有特定范围,则Identity的名称和公钥在该范围内是唯一的。
身份还具有一组证书(所有证书都证明其自己的公钥)。 这些证书中指定的主要名称不必相同,只需要密钥。
身份可以是子类,包括邮政和电子邮件地址,电话号码,面部图像和徽标等。
- 从以下版本开始:
 - 1.1
 - 另请参见:
 -  
         
IdentityScope,Signer,Principal, Serialized Form 
 
-  
        
       
-  
             
方法摘要
所有方法 实例方法 具体的方法 弃用的方法 变量和类型 方法 描述 voidaddCertificate(Certificate certificate)不推荐使用,要删除:此API元素将在以后的版本中删除。为此标识添加证书。Certificate[]certificates()不推荐使用,要删除:此API元素将在以后的版本中删除。返回此标识的所有证书的副本。booleanequals(Object identity)不推荐使用,要删除:此API元素将在以后的版本中删除。测试指定对象与此标识之间的相等性。StringgetInfo()不推荐使用,要删除:此API元素将在以后的版本中删除。返回先前为此标识指定的常规信息。StringgetName()不推荐使用,要删除:此API元素将在以后的版本中删除。返回此标识的名称。PublicKeygetPublicKey()不推荐使用,要删除:此API元素将在以后的版本中删除。返回此标识的公钥。IdentityScopegetScope()不推荐使用,要删除:此API元素将在以后的版本中删除。返回此标识的范围。inthashCode()不推荐使用,要删除:此API元素将在以后的版本中删除。返回此标识的哈希码。protected booleanidentityEquals(Identity identity)不推荐使用,要删除:此API元素将在以后的版本中删除。测试指定标识与此标识之间的相等性。voidremoveCertificate(Certificate certificate)不推荐使用,要删除:此API元素将在以后的版本中删除。从此标识中删除证书。voidsetInfo(String info)不推荐使用,要删除:此API元素将在以后的版本中删除。指定此标识的常规信息字符串。voidsetPublicKey(PublicKey key)不推荐使用,要删除:此API元素将在以后的版本中删除。设置此标识的公钥。StringtoString()不推荐使用,要删除:此API元素将在以后的版本中删除。返回描述此标识的短字符串,告知其名称及其范围(如果有)。StringtoString(boolean detailed)不推荐使用,要删除:此API元素将在以后的版本中删除。返回此标识的字符串表示形式,可选择的细节多于toString方法提供的不带任何参数的详细信息。 
 -  
             
 
-  
        
       
-  
             
构造方法详细信息
-  
Identity
protected Identity()
Deprecated, for removal: This API element is subject to removal in a future version.仅用于序列化的构造函数。 
-  
Identity
public Identity(String name, IdentityScope scope) throws KeyManagementException
Deprecated, for removal: This API element is subject to removal in a future version.构造具有指定名称和范围的标识。- 参数
 -  
              
name- 身份名称。 -  
              
scope- 身份的范围。 - 异常
 -  
              
KeyManagementException- 如果范围中已存在具有相同名称的标识。 
 
-  
Identity
public Identity(String name)
Deprecated, for removal: This API element is subject to removal in a future version.构造具有指定名称且不具有范围的标识。- 参数
 -  
              
name- 身份名称。 
 
 -  
 
-  
             
方法详细信息
-  
getName
public final String getName()
Deprecated, for removal: This API element is subject to removal in a future version.返回此标识的名称。 
-  
getScope
public final IdentityScope getScope()
Deprecated, for removal: This API element is subject to removal in a future version.返回此标识的范围。- 结果
 - 这个身份的范围。
 
 
-  
getPublicKey
public PublicKey getPublicKey()
Deprecated, for removal: This API element is subject to removal in a future version.返回此标识的公钥。- 结果
 - 这个身份的公钥。
 - 另请参见:
 -  
              
setPublicKey(java.security.PublicKey) 
 
-  
setPublicKey
public void setPublicKey(PublicKey key) throws KeyManagementException
Deprecated, for removal: This API element is subject to removal in a future version.设置此标识的公钥。 此操作将删除旧密钥和所有此身份证书。首先,如果有一个安全管理器,则调用其
checkSecurityAccess方法,并以"setIdentityPublicKey"作为其参数,以查看是否可以设置公钥。- 参数
 -  
              
key- 此标识的公钥。 - 异常
 -  
              
KeyManagementException- 如果标识范围内的另一个标识具有相同的公钥,或者发生另一个异常。 -  
              
SecurityException- 如果存在安全管理器且其checkSecurityAccess方法不允许设置公钥。 - 另请参见:
 -  
              
getPublicKey(),SecurityManager.checkSecurityAccess(java.lang.String) 
 
-  
setInfo
public void setInfo(String info)
Deprecated, for removal: This API element is subject to removal in a future version.指定此标识的常规信息字符串。首先,如果有安全管理器,则调用其
checkSecurityAccess方法,并以"setIdentityInfo"作为其参数,以查看是否可以指定信息字符串。- 参数
 -  
              
info- 信息字符串。 - 异常
 -  
              
SecurityException- 如果存在安全管理器且其checkSecurityAccess方法不允许设置信息字符串。 - 另请参见:
 -  
              
getInfo(),SecurityManager.checkSecurityAccess(java.lang.String) 
 
-  
getInfo
public String getInfo()
Deprecated, for removal: This API element is subject to removal in a future version.返回先前为此标识指定的常规信息。- 结果
 - 有关此身份的一般信息。
 - 另请参见:
 -  
              
setInfo(java.lang.String) 
 
-  
addCertificate
public void addCertificate(Certificate certificate) throws KeyManagementException
Deprecated, for removal: This API element is subject to removal in a future version.为此标识添加证书。 如果标识具有公钥,则证书中的公钥必须相同,如果标识没有公钥,则标识的公钥将设置为证书中指定的公钥。首先,如果有一个安全管理器,
checkSecurityAccess"addIdentityCertificate"作为其参数调用其checkSecurityAccess方法,以查看是否可以添加证书。- 参数
 -  
              
certificate- 要添加的证书。 - 异常
 -  
              
KeyManagementException- 如果证书无效,则添加的证书中的公钥与此标识的公钥冲突,或者是否发生另一个异常。 -  
              
SecurityException- 如果存在安全管理器且其checkSecurityAccess方法不允许添加证书。 - 另请参见:
 -  
              
SecurityManager.checkSecurityAccess(java.lang.String) 
 
-  
removeCertificate
public void removeCertificate(Certificate certificate) throws KeyManagementException
Deprecated, for removal: This API element is subject to removal in a future version.从此标识中删除证书。首先,如果有一个安全管理器,则调用其
checkSecurityAccess方法,并以"removeIdentityCertificate"作为其参数,以查看是否可以删除证书。- 参数
 -  
              
certificate- 要删除的证书。 - 异常
 -  
              
KeyManagementException- 如果证书丢失,或者发生另一个异常。 -  
              
SecurityException- 如果存在安全管理器且其checkSecurityAccess方法不允许删除证书。 - 另请参见:
 -  
              
SecurityManager.checkSecurityAccess(java.lang.String) 
 
-  
certificates
public Certificate[] certificates()
Deprecated, for removal: This API element is subject to removal in a future version.返回此标识的所有证书的副本。- 结果
 - 此身份的所有证书的副本。
 
 
-  
equals
public final boolean equals(Object identity)
Deprecated, for removal: This API element is subject to removal in a future version.测试指定对象与此标识之间的相等性。 这首先测试实体是否实际引用同一个对象,在这种情况下它返回true。 接下来,它检查实体是否具有相同的名称和相同的范围。 如果是,则该方法返回true。 否则,它调用identityEquals,子类应该覆盖。- Specified by:
 -  
              
equals在接口Principal - 重写:
 -  
              
equals,课程Object - 参数
 -  
              
identity- 要测试与此标识相等的对象。 - 结果
 - 如果对象被认为是相等的则为true,否则为false。
 - 另请参见:
 -  
              
identityEquals(java.security.Identity) 
 
-  
identityEquals
protected boolean identityEquals(Identity identity)
Deprecated, for removal: This API element is subject to removal in a future version.测试指定标识与此标识之间的相等性。 子类应该覆盖此方法以测试相等性。 如果名称和公钥相等,则默认行为是返回true。- 参数
 -  
              
identity- 用于测试与此标识的相等性的标识。 - 结果
 - 如果身份被认为是相等的则为true,否则为false。
 - 另请参见:
 -  
              
equals(java.lang.Object) 
 
-  
toString
public String toString()
Deprecated, for removal: This API element is subject to removal in a future version.返回描述此标识的短字符串,告知其名称及其范围(如果有)。首先,如果有一个安全管理器,
checkSecurityAccess"printIdentity"为参数调用其checkSecurityAccess方法,以查看是否可以返回该字符串。- Specified by:
 -  
              
toString接口Principal - 重写:
 -  
              
toString在课堂上Object - 结果
 - 有关此标识的信息,例如其名称和范围名称(如果有)。
 - 异常
 -  
              
SecurityException- 如果存在安全管理器且其checkSecurityAccess方法不允许返回描述此标识的字符串。 - 另请参见:
 -  
              
SecurityManager.checkSecurityAccess(java.lang.String) 
 
-  
toString
public String toString(boolean detailed)
Deprecated, for removal: This API element is subject to removal in a future version.返回此标识的字符串表示形式,可选择的详细信息比toString方法提供的更多详细信息,不带任何参数。首先,如果有安全管理器,其
checkSecurityAccess方法被调用"printIdentity"作为参数,看看它是否可以返回字符串。- 参数
 -  
              
detailed- 是否提供详细信息。 - 结果
 -  
              有关此身份的信息。 
              如果
detailed为true,则此方法返回的信息多于toString方法提供的信息,而不带任何参数。 - 异常
 -  
              
SecurityException- 如果存在安全管理器且其checkSecurityAccess方法不允许返回描述此标识的字符串。 - 另请参见:
 -  
              
toString(),SecurityManager.checkSecurityAccess(java.lang.String) 
 
-  
hashCode
public int hashCode()
Deprecated, for removal: This API element is subject to removal in a future version.返回此标识的哈希码。- Specified by:
 -  
              
hashCode接口Principal - 重写:
 -  
              
hashCodein classObject - 结果
 - 此身份的哈希码。
 - 另请参见:
 -  
              
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object) 
 
 -  
 
 -