public class KerberosKey extends Object implements SecretKey, Destroyable
所有的Kerberos JAAS登录模块,获得主的密码和它生成的密钥应该使用这类。有时,如在验证服务器在用户认证的情况下,登录模块将存储这类的实例设置一个Subject
在提交的认证过程相私人凭证。
Kerberos服务使用keytab读取密钥应该使用KeyTab
类,其中新键可以阅读需要的时候。
它可能被授予PrivateCredentialPermission
如果需要从主体准入kerberoskey实例的应用程序是必要的。此权限时不需要的应用程序依赖于默认的jgss Kerberos机制访问kerberoskey。然而在这种情况下,,应用程序将需要一个合适的ServicePermission
。
Constructor and Description |
---|
KerberosKey(KerberosPrincipal principal, byte[] keyBytes, int keyType, int versionNum)
构建了一个KerberosKey从给定的字节时的关键类型和版本号是关键。
|
KerberosKey(KerberosPrincipal principal, char[] password, String algorithm)
构建了从主密码KerberosKey。
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
销毁此键。
|
boolean |
equals(Object other)
指定对象与KerberosKey平等的比较。
|
String |
getAlgorithm()
返回此键的标准算法名称。
|
byte[] |
getEncoded()
返回此密钥密钥的密钥材料。
|
String |
getFormat()
返回此密钥的编码格式的名称。
|
int |
getKeyType()
返回此长期密钥的密钥类型。
|
KerberosPrincipal |
getPrincipal()
返回此键所属于的主体。
|
int |
getVersionNumber()
返回键版本号。
|
int |
hashCode()
返回此KerberosKey hashCode。
|
boolean |
isDestroyed()
确定此键是否已被销毁。
|
String |
toString()
返回对象的字符串表示形式。
|
public KerberosKey(KerberosPrincipal principal, byte[] keyBytes, int keyType, int versionNum)
principal
-主这个密钥属于
keyBytes
-密钥的原始字节
keyType
-密钥的Kerberos协议规范定义的主要类型。
versionNum
-这个密钥的版本号
public KerberosKey(KerberosPrincipal principal, char[] password, String algorithm)
principal
-校长这个密码属于
password
-应用于计算密钥的密码
algorithm
为算法,该密钥将用于名称。这个参数可能是空的,在这种情况下,默认的算法“德”将被假定。
IllegalArgumentException
如果算法通过名字是不支持的。
public final KerberosPrincipal getPrincipal()
public final int getVersionNumber()
public final int getKeyType()
public final String getAlgorithm()
getAlgorithm
接口
Key
public final byte[] getEncoded()
getEncoded
接口
Key
public void destroy() throws DestroyFailedException
destroy
接口
Destroyable
DestroyFailedException
破坏发生的一些错误。
public boolean isDestroyed()
isDestroyed
接口
Destroyable
Object
已毁真,否则为假。
public String toString()
Object
toString
方法返回一个字符串,“以文本方式表示”这个对象。其结果应该是一个简洁,但翔实的代表性,是一个容易阅读的人。建议所有子类都重写此方法。
Object
类的toString
方法返回一个包含该类的对象是一个实例的名称字符串的符号` @
',和符号进制表示的对象的哈希码。换句话说,此方法返回一个等于值的字符串:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public int hashCode()
hashCode
方法重写,继承类
Object
KerberosKey
hashcode()
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public boolean equals(Object other)
KerberosKey
和两
KerberosKey
实例是等价的。
equals
方法重写,继承类
Object
other
-对象比较
Object.hashCode()
,
HashMap
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.