EcPrivateKey
insteadpublic class ECDSAPrivateKey extends PrivateKeyInfo implements java.security.Key, java.security.spec.KeySpec, java.security.PrivateKey, java.io.Serializable, java.lang.Cloneable
The user specific part of the private key is a large integer which is ASN1 encoded as an INTEGER value. However, this value is then wrapped as a PKCS#8 object, so that additional information (such as the algorithm IDs and the parameter) can be added.
The ASN1 structure is as follows:
PrivateKeyInfo ::= SEQUENCE {
version Version,
privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
privateKey PrivateKey
attributes [0] IMPLICIT Attributes OPTIONAL }
where:
Version ::= INTEGER -- Syntax Version Number, must be 0.
PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
private key algorithm, i.e.,
must be a SEQUENCE containing the
OID "1.2.840.10045.2.1" and the
ECParameters value in ASN1 encoded form.
See ANSI X9.62.
PrivateKey ::= OCTET STRING the value of the private key, i.e.,
a BER encoded INTEGER value containing
the ECDSA private key.
Attributes ::= SET OF Attribute additional information,
will be ignored if there is any.
private_key_algorithm, private_key_info| Constructor and Description |
|---|
ECDSAPrivateKey(ASN1Object object)
Deprecated.
Initializes the ECDSA private key with an ASN1 structure.
|
ECDSAPrivateKey(byte[] array)
Deprecated.
Initializes the ECDSA private key with a DER encoded ASN1 structure.
|
ECDSAPrivateKey(ECParameters params,
java.math.BigInteger privateExponent)
Deprecated.
Default public constructor that takes the parameter and the private
exponent as arguments.
|
ECDSAPrivateKey(java.io.InputStream is)
Deprecated.
Initializes the ECDSA private key with a DER encoded ASN1 structure given
as an input stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
decode(byte[] key)
Deprecated.
Initializes the private exponent of the calling ECDSA private key with a DER
encoded ASN1 structure.
|
byte[] |
encode()
Deprecated.
Encodes the private exponent of the calling ECDSA private key as a DER
encoded ASN1 structure (INTEGER).
|
java.lang.String |
getAlgorithm()
Deprecated.
Returns the name of the calling algorithm ECDSA.
|
ECParameters |
getECParameters()
Deprecated.
Returns the parameter value.
|
java.lang.String |
getFormat()
Deprecated.
Returns the name of the primary encoding format of this key PKCS#8.
|
java.math.BigInteger |
getPrivateExponent()
Deprecated.
Returns the private exponent.
|
createPrivateKeyInfo, decode, equals, getEncoded, getPrivateKey, getPrivateKey, toASN1Object, toString, writeTopublic ECDSAPrivateKey(ECParameters params, java.math.BigInteger privateExponent)
params - the parameter set used for computing with the private keyprivateExponent - the real private informationpublic ECDSAPrivateKey(ASN1Object object) throws java.security.InvalidKeyException
object - - the private key as an ASN1Object structure
java.security.InvalidKeyException - if the object is malformedpublic ECDSAPrivateKey(byte[] array)
throws java.security.InvalidKeyException
array - the private key as DER encoded ASN1 structure
java.security.InvalidKeyException - if the object is malformed.public ECDSAPrivateKey(java.io.InputStream is)
throws java.security.InvalidKeyException,
java.io.IOException
is - the private key as DER encoded ASN1 structure as an input stream
InvalidKeyException, - IOException
if the object is malformed.java.security.InvalidKeyExceptionjava.io.IOExceptionpublic void decode(byte[] key)
throws java.security.InvalidKeyException
The private exponent must provided as a DER encoded INTEGER object.
decode in class PrivateKeyInfokey - the private key as DER encoded ASN1 structure (INTEGER)java.security.InvalidKeyException - if the object is malformed.public byte[] encode()
encode in class PrivateKeyInfopublic java.lang.String getAlgorithm()
getAlgorithm in interface java.security.KeygetAlgorithm in class PrivateKeyInfoString "ECDSA"public ECParameters getECParameters() throws CodingException
ECParameters objectCodingExceptionpublic java.math.BigInteger getPrivateExponent()
BigInteger objectpublic java.lang.String getFormat()
getFormat in interface java.security.KeygetFormat in class PrivateKeyInfoString "PKCS#8"