public interface SecretKey extends Key, Destroyable
这个接口的提供者必须覆盖equals
和hashCode
方法继承了Object
,使密钥是基于其潜在的关键材料和不基于参考比较。实现应该重写默认的destroy
和isDestroyed
方法从Destroyable
接口使敏感的关键信息被破坏、清除,或在的情况下,这样的信息是不可变的,无用的。最后,由于SecretKey
是Serializable
,实现应该覆盖ObjectOutputStream.writeObject(java.lang.Object)
防止已序列化销毁密钥。
键实现此接口的编码格式返回字符串RAW
(见getFormat
),并返回原始密钥字节作为一个getEncoded
方法调用的结果。(这getFormat
和getEncoded
方法从Key
继承父接口。)
SecretKeyFactory
,
Cipher
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID
这类指纹设置表示序列化兼容从J2SE 1.4。
|
getAlgorithm, getEncoded, getFormat
destroy, isDestroyed
static final long serialVersionUID
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.