public class EdDSAPrivateKey extends Object implements EdDSAKey, PrivateKey
Warning: Private key encoding is not fully specified in the current IETF draft. This implementation uses PKCS#8 encoding, and is subject to change. See getEncoded().
Ref: https://tools.ietf.org/html/draft-josefsson-pkix-eddsa-04
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()
This follows the docs from
java.security.spec.PKCS8EncodedKeySpec
quote:
|
String |
getFormat() |
byte[] |
getH() |
EdDSAParameterSpec |
getParams()
return a parameter specification representing the EdDSA domain
parameters for the key.
|
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()
The PrivateKeyInfo syntax is defined in the PKCS#8 standard as follows: PrivateKeyInfo ::= SEQUENCE { version Version, privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, privateKey PrivateKey, attributes [0] IMPLICIT Attributes OPTIONAL } Version ::= INTEGER PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier PrivateKey ::= OCTET STRING Attributes ::= SET OF Attribute
AlgorithmIdentifier ::= SEQUENCE { algorithm OBJECT IDENTIFIER, parameters ANY OPTIONAL }Ref: https://tools.ietf.org/html/draft-josefsson-pkix-eddsa-04 Note that the private key encoding is not fully specified in the Josefsson draft version 04, and the example could be wrong, as it's lacking Version and AlgorithmIdentifier. This will hopefully be clarified in the next draft. But sun.security.pkcs.PKCS8Key expects them so we must include them for keytool to work. 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.
getEncoded
in interface Key
public EdDSAParameterSpec getParams()
EdDSAKey
public byte[] getSeed()
public byte[] getH()
public byte[] geta()
public GroupElement getA()
public byte[] getAbyte()