Module java.base
Package java.security

Class IdentityScope

java.lang.Object
java.security.Identity
java.security.IdentityScope
所有已实现的接口:
Serializable, Principal

@Deprecated(since="1.2", forRemoval=true) public abstract class IdentityScope extends Identity
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 by java.security.KeyStore, the java.security.cert package, and java.security.Principal.

此类表示身份的范围。它本身是一个身份,因此具有名称并且可以具有范围。它还可以选择性地具有公钥和相关证书。

IdentityScope 可以包含各种类型的 Identity 对象,包括签名者。可以使用相同的方法检索、添加和删除所有类型的 Identity 对象。请注意,不同类型的身份范围可能会对其各种操作上的各种类型的身份应用不同的策略是可能的,实际上是期望的。

密钥和身份之间存在一对一的映射,每个范围中只能有一个密钥的副本。例如,假设用户已知软件发布商 Acme Software, Inc。假设它是一个身份,即它具有公钥和一组相关证书。它在范围中使用名称“Acme Software”命名。范围中没有其他具有相同公钥的命名身份。当然,也没有相同的名称。

自版本:
1.1
参见:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    此构造函数仅用于序列化,不应被子类使用。
     
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    使用指定的名称构造一个新的身份范围。
     
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    使用指定的名称和范围构造一个新的身份范围。
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    addIdentity(Identity identity)
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    将一个 Identity 添加到此身份范围中。
    abstract Identity
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    返回此范围中具有指定名称的 Identity(如果有)。
    getIdentity(Principal principal)
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    检索与指定主体名称相同的 Identity
    abstract Identity
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    检索具有指定公钥的 identity
    static IdentityScope
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    返回系统的身份范围。
    abstract Enumeration<Identity>
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    返回此身份范围中所有身份的枚举。
    abstract void
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    从此身份范围中移除一个 Identity
    protected static void
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    设置系统的身份范围。
    abstract int
    size()
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    返回此身份范围中的身份数量。
    已弃用,将来会移除: 此 API 元素将来可能会被移除。
    返回此身份范围的字符串表示,包括其名称、范围名称以及此身份范围中的身份数量。

    Methods declared in class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods declared in interface java.security.Principal

    implies
  • Constructor Details

    • IdentityScope

      protected IdentityScope()
      Deprecated, for removal: This API element is subject to removal in a future version.
      此构造函数仅用于序列化,不应被子类使用。
    • IdentityScope

      public IdentityScope(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      使用指定的名称构造一个新的身份范围。
      参数:
      name - 范围名称。
    • IdentityScope

      public IdentityScope(String name, IdentityScope scope) throws KeyManagementException
      Deprecated, for removal: This API element is subject to removal in a future version.
      使用指定的名称和范围构造一个新的身份范围。
      参数:
      name - 范围名称。
      scope - 新身份范围的范围。
      抛出:
      KeyManagementException - 如果范围中已经存在具有相同名称的 Identity
  • Method Details

    • getSystemScope

      public static IdentityScope getSystemScope()
      Deprecated, for removal: This API element is subject to removal in a future version.
      返回系统的身份范围。
      返回:
      系统的身份范围,如果尚未设置则返回 null
      参见:
    • setSystemScope

      protected static void setSystemScope(IdentityScope scope)
      Deprecated, for removal: This API element is subject to removal in a future version.
      设置系统的身份范围。

      首先,如果存在安全管理器,则调用其 checkSecurityAccess 方法,参数为 "setSystemScope",以查看是否可以设置身份范围。

      参数:
      scope - 要设置的范围。
      抛出:
      SecurityException - 如果存在安全管理器且其 checkSecurityAccess 方法不允许设置身份范围。
      参见:
    • size

      public abstract int size()
      Deprecated, for removal: This API element is subject to removal in a future version.
      返回此身份范围中的身份数量。
      返回:
      此身份范围中的身份数量。
    • getIdentity

      public abstract Identity getIdentity(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      返回此范围中具有指定名称的 Identity(如果有)。
      参数:
      name - 要检索的 Identity 的名称。
      返回:
      名称为 nameIdentity,如果此范围中没有名称为 name 的身份则返回 null
    • getIdentity

      public Identity getIdentity(Principal principal)
      Deprecated, for removal: This API element is subject to removal in a future version.
      检索与指定主体名称相同的 Identity。(注意: Identity 实现了 Principal。)
      参数:
      principal - 对应于要检索的 Identity 的主体。
      返回:
      其名称与主体相同的 Identity,如果此范围中没有同名身份则返回 null
    • getIdentity

      public abstract Identity getIdentity(PublicKey key)
      Deprecated, for removal: This API element is subject to removal in a future version.
      检索具有指定公钥的 identity
      参数:
      key - 要返回的身份的公钥。
      返回:
      具有给定密钥的身份,如果此范围中没有具有该密钥的身份则返回 null
    • addIdentity

      public abstract void addIdentity(Identity identity) throws KeyManagementException
      Deprecated, for removal: This API element is subject to removal in a future version.
      将一个 Identity 添加到此身份范围中。
      参数:
      identity - 要添加的 Identity
      抛出:
      KeyManagementException - 如果身份无效、名称冲突发生、另一个身份具有与要添加的身份相同的公钥,或发生其他异常。
    • removeIdentity

      public abstract void removeIdentity(Identity identity) throws KeyManagementException
      Deprecated, for removal: This API element is subject to removal in a future version.
      从此身份范围中移除一个 Identity
      参数:
      identity - 要移除的 Identity
      抛出:
      KeyManagementException - 如果缺少身份,或发生其他异常。
    • identities

      public abstract Enumeration<Identity> identities()
      Deprecated, for removal: This API element is subject to removal in a future version.
      返回此身份范围中所有身份的枚举。
      返回:
      此身份范围中所有身份的枚举。
    • toString

      public String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      返回此身份范围的字符串表示,包括其名称、范围名称以及此身份范围中的身份数量。
      指定者:
      toString 在接口 Principal
      覆盖:
      toString 在类 Identity
      返回:
      此身份范围的字符串表示。
      参见: