| Modifier and Type | Field and Description |
|---|---|
| protected AlgorithmId | |
| private byte[] | |
| protected byte[] | |
| protected byte[] | |
| protected byte[] | |
| private static final long | serialVersionUID
use serialVersionUID from JDK 1.1.
|
| public static final int | |
| public static final int | |
| private int |
| Access | Constructor and Description |
|---|---|
| protected | |
| public | |
| public | PKCS8Key(byte[] publicEncoding, byte[] privateEncoding)
Constructor that takes both public and private encodings. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private void | |
| public boolean | Returns: true if this key has the same encoding as the
object argument; false otherwise.the object with which to compare object)Overrides java. Compares two private keys. |
| private byte[] | |
| public String | getAlgorithm()
Implements java. Returns the algorithm to be used with this key. |
| public AlgorithmId | |
| public byte[] | getEncoded()
Implements java. Returns the DER-encoded form of the key as a byte array,
or |
| public static byte[] | Returns: DER-encoded byte arrayDER-encoded PublicKey, this may be null. pubKeyEncoded, byte[] DER-encoded PrivateKey privKeyEncoded)With a given encoded Public and Private key, generate and return a PKCS8v2 DER-encoded byte[]. |
| private synchronized byte[] | Returns: the encodingDER-encodes this key as a byte array stored inside this object and return it. |
| public String | |
| public byte[] | |
| public int | |
| public int | |
| public boolean | |
| public static PrivateKey | parseKey(byte[]
the DER-encoded SubjectPublicKeyInfo value encoded)Construct PKCS#8 subject public key from a DER encoding. |
| public static PrivateKey | |
| private void | readObject(ObjectInputStream stream)
We used to serialize a PKCS8Key as itself (instead of a KeyRep). |
| protected Object |
| algid | back to summary |
|---|---|
| protected AlgorithmId algid | |
| attributes | back to summary |
|---|---|
| private byte[] attributes | |
| encodedKey | back to summary |
|---|---|
| protected byte[] encodedKey | |
| privKeyMaterial | back to summary |
|---|---|
| protected byte[] privKeyMaterial | |
| pubKeyEncoded | back to summary |
|---|---|
| protected byte[] pubKeyEncoded | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. use serialVersionUID from JDK 1.1. for interoperability | |
| V1 | back to summary |
|---|---|
| public static final int V1 | |
| V2 | back to summary |
|---|---|
| public static final int V2 | |
| version | back to summary |
|---|---|
| private int version | |
| PKCS8Key | back to summary |
|---|---|
| protected PKCS8Key() Default constructor. Constructors in subclasses that create a new key
from its components require this. These constructors must initialize
| |
| PKCS8Key | back to summary |
|---|---|
| public PKCS8Key(byte[] input) throws InvalidKeyException Another constructor. Constructors in subclasses that create a new key
from an encoded byte array require this. We do not assign this
encoding to | |
| PKCS8Key | back to summary |
|---|---|
| public PKCS8Key(byte[] publicEncoding, byte[] privateEncoding) throws InvalidKeyException Constructor that takes both public and private encodings. If the private key includes a public key encoding (like an EC key in SEC1v2 format), and a specified public key matches it, the existing encoding is reused rather than recreated. | |
| clear | back to summary |
|---|---|
| public void clear() | |
| decode | back to summary |
|---|---|
| private void decode(DerValue val) throws InvalidKeyException Method for decoding PKCS8 v1 and v2 formats. Decoded values are stored in this class, key material remains in DER format for algorithm subclasses to decode. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides java. Compares two private keys. This returns false if the object with which
to compare is not of type | |
| generateEncoding | back to summary |
|---|---|
| private byte[] generateEncoding() throws IOException | |
| getAlgorithm | back to summary |
|---|---|
| public String getAlgorithm() Implements java. Returns the algorithm to be used with this key. | |
| getAlgorithmId | back to summary |
|---|---|
| public AlgorithmId getAlgorithmId() Returns the algorithm ID to be used with this key. | |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded() Implements java. Returns the DER-encoded form of the key as a byte array,
or | |
| getEncoded | back to summary |
|---|---|
| public static byte[] getEncoded(byte[] pubKeyEncoded, byte[] privKeyEncoded) throws IOException With a given encoded Public and Private key, generate and return a PKCS8v2 DER-encoded byte[].
| |
| getEncodedInternal | back to summary |
|---|---|
| private synchronized byte[] getEncodedInternal() DER-encodes this key as a byte array stored inside this object and return it.
| |
| getFormat | back to summary |
|---|---|
| public String getFormat() Implements java. Returns the format for this key: "PKCS#8" | |
| getPubKeyEncoded | back to summary |
|---|---|
| public byte[] getPubKeyEncoded() | |
| getVersion | back to summary |
|---|---|
| public int getVersion() | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Calculates a hash code value for this object. Objects which are equal will also have the same hashcode.
| |
| hasPublicKey | back to summary |
|---|---|
| public boolean hasPublicKey() | |
| parseKey | back to summary |
|---|---|
| public static PrivateKey parseKey(byte[] encoded) throws InvalidKeyException Construct PKCS#8 subject public key from a DER encoding. If a security provider supports the key algorithm with a specific class, a PrivateKey from the provider is returned. Otherwise, a raw PKCS8Key object is returned. This mechanism guarantees 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 accommodated.
| |
| parseKey | back to summary |
|---|---|
| public static PrivateKey parseKey(byte[] encoded, Provider provider) throws InvalidKeyException | |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream stream) throws IOException We used to serialize a PKCS8Key as itself (instead of a KeyRep).
| |
| writeReplace | back to summary |
|---|---|
protected Object writeReplace() throws ObjectStreamException
| |