Class Overview
KeyRep
is a standardized representation for serialized Key
objects.
Summary
Nested Classes |
enum |
KeyRep.Type |
Type enumerates the supported key types. |
Public Constructors |
|
KeyRep(KeyRep.Type type, String algorithm, String format, byte[] encoded)
Constructs a new instance of KeyRep with the specified arguments.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Called before the object's memory is reclaimed by the VM.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
Public Constructors
public
KeyRep
(KeyRep.Type type, String algorithm, String format, byte[] encoded)
Constructs a new instance of KeyRep
with the specified arguments.
The arguments should be obtained from the Key
object that has to
be serialized.
Parameters
type
| the type of the key. |
algorithm
| the algorithm (obtained by getAlgorithm() ). |
format
| the format of the key (obtained by getFormat() ). |
encoded
| the encoded byte[] (obtained by
getEncoded() ). |
Protected Methods
protected
Object
readResolve
()
Resolves and returns the Key
object. Three KeyRep.Type
|format
combinations are supported:
-
Type.PRIVATE
| "PKCS#8" : returns a PrivateKey
instance, generated from a key factory (suitable for the algorithm) that
is initialized with a PKCS8EncodedKeySpec
using the encoded key
bytes.
-
Type.SECRET
| "RAW" : returns a SecretKeySpec
instance, created with the encoded key bytes and the algorithm.
-
Type.PUBLIC
| "X.509": returns a PublicKey
instance,
generated from a key factory (suitable for the algorithm) that is
initialized with a X509EncodedKeySpec
using the encoded key
bytes.
Throws
ObjectStreamException
| if the Type |format combination is not recognized, or
the resolution of any key parameter fails.
|