- java.lang.Object
-
- javax.security.auth.kerberos.EncryptionKey
-
- 实现的所有接口
-
Serializable,Key,SecretKey,Destroyable
public final class EncryptionKey extends Object implements SecretKey
此类封装Kerberos中使用的EncryptionKey。EncryptionKey在Kerberos协议规范( RFC 4120 )的第4.2.9节中定义为:
EncryptionKey ::= SEQUENCE { keytype [0] Int32 -- actually encryption type --, keyvalue [1] OCTET STRING }EncryptionKey的关键材料定义为上面的keyValue的值。- 从以下版本开始:
- 9
- 另请参见:
- Serialized Form
-
-
构造方法摘要
构造方法 构造器 描述 EncryptionKey(byte[] keyBytes, int keyType)根据给定的字节和密钥类型构造一个EncryptionKey。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 voiddestroy()通过清除此密钥的密钥材料来销毁此密钥。booleanequals(Object other)将指定对象与此键进行比较以获得相等性。StringgetAlgorithm()返回此键的标准算法名称。byte[]getEncoded()返回此键的密钥材料。StringgetFormat()返回此键的编码格式的名称。intgetKeyType()返回此键的键类型。inthashCode()返回此EncryptionKey的哈希码。StringtoString()返回此EncryptionKey的信息性文本表示EncryptionKey。-
声明方法的接口 javax.security.auth.Destroyable
isDestroyed
-
-
-
-
构造方法详细信息
-
EncryptionKey
public EncryptionKey(byte[] keyBytes, int keyType)根据给定的字节和密钥类型构造一个EncryptionKey。复制字节数组的内容; 后续修改字节数组不会影响新创建的密钥。
- 参数
-
keyBytes- 密钥的关键材料 -
keyType- Kerberos协议规范定义的密钥的密钥类型。 - 异常
-
NullPointerException- 如果keyBytes为null
-
-
方法详细信息
-
getKeyType
public int getKeyType()
返回此键的键类型。- 结果
- 关键类型。
- 异常
-
IllegalStateException- 如果密钥被破坏
-
getAlgorithm
public String getAlgorithm()
返回此键的标准算法名称。 算法名称是IANA Kerberos Encryption Type Numbers页面上定义的加密类型字符串。此方法可以返回IANA页面上未定义的以下值:
- none:对于etype等于0
- unknown:对于etype大于0但不受实现支持
- private:对于小于0的etype
- Specified by:
-
getAlgorithm在界面Key - 结果
- 与此键关联的算法的名称。
- 异常
-
IllegalStateException- 如果密钥被破坏
-
getFormat
public String getFormat()
返回此键的编码格式的名称。- Specified by:
-
getFormat在界面Key - 结果
- 字符串“RAW”
- 异常
-
IllegalStateException- 如果密钥被销毁
-
getEncoded
public byte[] getEncoded()
返回此键的密钥材料。- Specified by:
-
getEncodedin interfaceKey - 结果
- 包含密钥材料的新分配的字节数组
- 异常
-
IllegalStateException- 如果密钥被销毁
-
destroy
public void destroy() throws DestroyFailedException通过清除此密钥的密钥材料来销毁此密钥。- Specified by:
-
destroy在界面Destroyable - 异常
-
DestroyFailedException- 如果在破坏此密钥时发生某些错误。
-
toString
public String toString()
返回此EncryptionKey的信息性文本表示。
-
hashCode
public int hashCode()
返回此EncryptionKey的哈希码。- 重写:
-
hashCode在类Object - 结果
-
此
EncryptionKey的哈希码。 - 另请参见:
-
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
-
equals
public boolean equals(Object other)
将指定对象与此键进行比较以获得相等性。 如果给定对象也是EncryptionKey且两个EncryptionKey实例等效,则返回true。 更正式地EncryptionKey如果两个EncryptionKey实例具有相同的密钥类型和密钥材料,则它们是相等的。 被破坏的EncryptionKey对象仅等于它自己。- 重写:
-
equals在类Object - 参数
-
other- 要比较的对象 - 结果
-
如果指定的对象等于此
EncryptionKey,则返回true,否则EncryptionKeyfalse。 - 另请参见:
-
Object.hashCode(),HashMap
-
-