| java.lang.Object sun.security.pkcs.PKCS8Key
All known Subclasses: sun.security.provider.DSAPrivateKey,
PKCS8Key | public class PKCS8Key implements PrivateKey(Code) | | Holds a PKCS#8 key, for example a private key
version: 1.38, 02/02/00 author: Dave Brownell author: Benjamin Renaud |
Constructor Summary | |
public | PKCS8Key() Default constructor. |
encodedKey | protected byte[] encodedKey(Code) | | |
PKCS8Key | public PKCS8Key()(Code) | | Default constructor. The key constructed must have its key
and algorithm initialized before it may be used, for example
by using decode .
|
decode | public void decode(InputStream in) throws InvalidKeyException(Code) | | Initialize an PKCS8Key object from an input stream. The data
on that input stream must be encoded using DER, obeying the
PKCS#8 format: a sequence consisting of a version, an algorithm
ID and a bit string which holds the key. (That bit string is
often used to encapsulate another DER encoded sequence.)
Subclasses should not normally redefine this method; they should
instead provide a parseKeyBits method to parse any
fields inside the key member.
Parameters: in - an input stream with a DER-encoded PKCS#8SubjectPublicKeyInfo value exception: InvalidKeyException - if a parsing error occurs. |
equals | public boolean equals(Object object)(Code) | | Compares two private keys. This returns false if the object with which
to compare is not of type Key .
Otherwise, the encoding of this key object is compared with the
encoding of the given key object.
Parameters: object - the object with which to compare true if this key has the same encoding as theobject argument; false otherwise. |
getAlgorithm | public String getAlgorithm()(Code) | | Returns the algorithm to be used with this key.
|
getAlgorithmId | public AlgorithmId getAlgorithmId()(Code) | | Returns the algorithm ID to be used with this key.
|
getEncoded | public synchronized byte[] getEncoded()(Code) | | Returns the DER-encoded form of the key as a byte array.
|
getFormat | public String getFormat()(Code) | | Returns the format for this key: "PKCS#8"
|
hashCode | public int hashCode()(Code) | | Calculates a hash code value for this object. Objects
which are equal will also have the same hashcode.
|
parseKey | public static PrivateKey parseKey(DerValue in) throws IOException(Code) | | Construct PKCS#8 subject public key from a DER value. If
the runtime environment is configured with a specific class for
this kind of key, a subclass is returned. Otherwise, a generic
PKCS8Key object is returned.
This mechanism gurantees that keys (and algorithms) may be
freely manipulated and transferred, without risk of losing
information. Also, when a key (or algorithm) needs some special
handling, that specific need can be accomodated.
Parameters: in - the DER-encoded SubjectPublicKeyInfo value exception: IOException - on data format errors |
parseKeyBits | protected void parseKeyBits() throws IOException, InvalidKeyException(Code) | | Parse the key bits. This may be redefined by subclasses to take
advantage of structure within the key. For example, RSA public
keys encapsulate two unsigned integers (modulus and exponent) as
DER values within the key bits; Diffie-Hellman and
DSS/DSA keys encapsulate a single unsigned integer.
This function is called when creating PKCS#8 SubjectPublicKeyInfo
values using the PKCS8Key member functions, such as parse
and decode .
exception: IOException - if a parsing error occurs. exception: InvalidKeyException - if the key encoding is invalid. |
|
|