EVALUATION
1. new public serialized key representation:
public class java.security.KeyRep {
public KeyRep(String type, // "PublicKey|PrivateKey|SecretKey"
String algorithm,
String encoding, // "X509|PKCS8|RAW"
byte[] encoded) { }
protected Object readResolve() throws ObjectStreamException {
// use KeyFactory to create key
}
}
2 modify PublicKey/PrivateKey/SecretKey javadocs to state (respectively):
A PublicKey should use KeyRep as its serialized form.
(don't say anything about encodings - anything is fine)
our provider Key classes would writeReplace KeyRep,
but also implement readObject so it can deserialize
pre-1.5 keys if it gets one (if KeyRep is received,
KeyRep's readResolve is used).
|