JavaTM Platform
Standard Ed. 6

java.security
类 KeyRep

java.lang.Object
  继承者 java.security.KeyRep
所有已实现的接口:
Serializable

public class KeyRep
     
extends Object
implements Serializable

已序列化的 Key 对象的标准表示形式。

注意,序列化的 Key 可能包含不应该在不可信任的环境中显示的敏感信息。有关更多信息,请参见序列化规范的安全附录

从以下版本开始:
1.5
另请参见:
Key, KeyFactory, SecretKeySpec, X509EncodedKeySpec, PKCS8EncodedKeySpec, 序列化表格

嵌套类摘要
static class KeyRep.Type
          Key 类型。
 
构造方法摘要
KeyRep(KeyRep.Type type, String algorithm, String format, byte[] encoded)
          构造替换的 Key 类。
 
方法摘要
protected  Object readResolve()
          解析 Key 对象。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

KeyRep

public KeyRep(KeyRep.Type type,
              String algorithm,
              String format,
              byte[] encoded)
构造替换的 Key 类。

参数:
type - Type.SECRET、Type.PUBLIC 或 Type.PRIVATE 之一
algorithm - 从 Key.getAlgorithm() 返回的算法
format - 从 Key.getFormat() 返回的编码格式
encoded - 从 Key.getEncoded() 返回的编码字节
抛出:
NullPointerException - 如果 type 为 null、algorithm 为 null、format 为 null 或 encoded 为 null
方法详细信息

readResolve

protected Object readResolve()
                      throws ObjectStreamException
解析 Key 对象。

此方法支持三种 Type/format 组合:

返回:
解析的 Key 对象
抛出:
ObjectStreamException - 如果 Type/format 组合是不能识别的;如果算法、密钥格式或编码的密钥字节是不能识别的/无效的;如果由于任何原因密钥解析失败。

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策