public class EdDSAPrivateKey extends Object implements EdDSAKey, PrivateKey
For compatibility with older releases, decoding supports both RFC 8410 and an older draft specifications.
KEY_ALGORITHM
Constructor and Description |
---|
EdDSAPrivateKey(EdDSAPrivateKeySpec spec) |
EdDSAPrivateKey(PKCS8EncodedKeySpec spec) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
byte[] |
geta() |
GroupElement |
getA() |
byte[] |
getAbyte() |
String |
getAlgorithm() |
byte[] |
getEncoded()
Returns the private key in its canonical encoding.
|
String |
getFormat() |
byte[] |
getH() |
EdDSAParameterSpec |
getParams() |
byte[] |
getSeed() |
int |
hashCode() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
destroy, isDestroyed
public EdDSAPrivateKey(EdDSAPrivateKeySpec spec)
public EdDSAPrivateKey(PKCS8EncodedKeySpec spec) throws InvalidKeySpecException
InvalidKeySpecException
public String getAlgorithm()
getAlgorithm
in interface Key
public byte[] getEncoded()
This implements the following specs:
This encodes the seed. It will return null if constructed from a spec which was directly constructed from H, in which case seed is null.
For keys in older formats, decoding and then re-encoding is sufficient to migrate them to the canonical encoding.
Relevant spec quotes:
OneAsymmetricKey ::= SEQUENCE { version Version, privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, privateKey PrivateKey, attributes [0] IMPLICIT Attributes OPTIONAL, ..., [[2: publicKey [1] IMPLICIT PublicKey OPTIONAL ]], ... } Version ::= INTEGER PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier PrivateKey ::= OCTET STRING PublicKey ::= BIT STRING Attributes ::= SET OF Attribute
... when encoding a OneAsymmetricKey object, the private key is wrapped in a CurvePrivateKey object and wrapped by the OCTET STRING of the "privateKey" field. CurvePrivateKey ::= OCTET STRING
AlgorithmIdentifier ::= SEQUENCE { algorithm OBJECT IDENTIFIER, parameters ANY DEFINED BY algorithm OPTIONAL } For all of the OIDs, the parameters MUST be absent.
id-Ed25519 OBJECT IDENTIFIER ::= { 1 3 101 112 }
getEncoded
in interface Key
public EdDSAParameterSpec getParams()
public byte[] getSeed()
public byte[] getH()
public byte[] geta()
public GroupElement getA()
public byte[] getAbyte()
Copyright © 2019. All rights reserved.