This key is generated by either a sun.
or sun.. Its getAlgorithm method
returns the algorithm family name, while its getParams() method returns
the parameter set name as a NamedParameterSpec object. The algorithm
identifier in the PKCS #8 encoding of the key is always a single OID derived
from the parameter set name.
Besides the existing PKCS8Key#privKeyMaterial field, this class optionally
supports an expanded format stored in expanded. While privKeyMaterial
always represents the format used for encoding, expanded is always used
in computations. The expanded format must be self-sufficient for
cryptographic computations without requiring the encoding format.
privKeyMaterial is present, it's also the expanded format.
privKeyMaterial and expanded are available, privKeyMaterial
is the encoding format, and expanded is the expanded format.
If the two formats are the same, only privKeyMaterial is included, and
expanded must be null. Some implementations might be tempted to put the
same value into privKeyMaterial and expanded. However, problems can
arise if they happen to be the same object. To avoid ambiguity, always set
expanded to null.
If the expanded field is required by the algorithm, it is either
calculated from the PKCS #8 encoding,
or provided directly.
In the latter case, the caller must ensure the consistency of the encoded
and expanded arguments. For example, seed and expanded key must match.
sun.security.provider.NamedKeyPairGenerator
| Modifier and Type | Class and Description |
|---|---|
| public static interface | NamedPKCS8Key.
Expands from encoding format to expanded format. |
| Modifier and Type | Field and Description |
|---|---|
| private transient boolean | |
| private final transient byte[] | |
| private final String | |
| private final transient NamedParameterSpec | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| private | NamedPKCS8Key(String
family name fname, String parameter set name pname, byte[] raw key bytes, not null encoded, byte[] expanded key format, can be expanded)null.Creates a |
| public | NamedPKCS8Key(String
family name fname, byte[] PKCS #8 encoding. It is copied so caller can modify
it after the method call. encoded, NamedPKCS8Key.a function that is able to calculate the expanded
format from the encoding format inside expanderencoded. If it recognizes
the input already in expanded format, it must return null.
This argument must be null if the algorithm's expanded format
is always the same as its encoding format. Whatever the case, the
ownership of the result is fully granted to this object.Creates a |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public String | getAlgorithm()
Overrides sun. Implements java. Returns the algorithm to be used with this key. |
| public byte[] | |
| public NamedParameterSpec | getParams()
Overrides default java. Returns the parameters associated with this key. |
| public byte[] | |
| public static NamedPKCS8Key | internalCreate(String
family name fname, String parameter set name pname, byte[] raw key bytes, not null encoded, byte[] expanded key format, can be expanded)null.Creates a |
| public boolean | isDestroyed()
Overrides default javax. Determine if this |
| private void | readObject(ObjectInputStream stream)
Hides sun. We used to serialize a PKCS8Key as itself (instead of a KeyRep). |
| public String |
| destroyed | back to summary |
|---|---|
| private transient boolean destroyed | |
| expanded | back to summary |
|---|---|
| private final transient byte[] expanded | |
| fname | back to summary |
|---|---|
| private final String fname | |
| paramSpec | back to summary |
|---|---|
| private final transient NamedParameterSpec paramSpec | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides sun. | |
| NamedPKCS8Key | back to summary |
|---|---|
| private NamedPKCS8Key(String fname, String pname, byte[] encoded, byte[] expanded) Creates a | |
| NamedPKCS8Key | back to summary |
|---|---|
| public NamedPKCS8Key(String fname, byte[] encoded, NamedPKCS8Key. Creates a
| |
| destroy | back to summary |
|---|---|
| public void destroy() Overrides default javax. Doc from javax. Destroy this Sensitive information associated with this
| |
| getAlgorithm | back to summary |
|---|---|
| public String getAlgorithm() Overrides sun. Implements java. Doc from sun. Returns the algorithm to be used with this key.
| |
| getExpanded | back to summary |
|---|---|
| public byte[] getExpanded() Returns the reference to the key in expanded format. Caller must not modify the content or pass the reference to untrusted application code. | |
| getParams | back to summary |
|---|---|
| public NamedParameterSpec getParams() Overrides default java. Doc from java. Returns the parameters associated with this key. The parameters are optional and may be either explicitly specified or implicitly created during key pair generation.
| |
| getRawBytes | back to summary |
|---|---|
| public byte[] getRawBytes() Returns the reference to the internal key. Caller must not modify the content or pass the reference to untrusted application code. | |
| internalCreate | back to summary |
|---|---|
| public static NamedPKCS8Key internalCreate(String fname, String pname, byte[] encoded, byte[] expanded) Creates a
| |
| isDestroyed | back to summary |
|---|---|
| public boolean isDestroyed() Overrides default javax. Doc from javax. Determine if this
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException Hides sun. Doc from sun. We used to serialize a PKCS8Key as itself (instead of a KeyRep).
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| Modifier and Type | Method and Description |
|---|---|
| public byte[] |
| expand | back to summary |
|---|---|
| public byte[] expand(String pname, byte[] input) throws InvalidKeyException The expand method
| |