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() |
public EdDSAPrivateKey(EdDSAPrivateKeySpec spec)
public EdDSAPrivateKey(PKCS8EncodedKeySpec spec) throws InvalidKeySpecException
InvalidKeySpecExceptionpublic String getAlgorithm()
getAlgorithm in interface Keypublic 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.getEncoded in interface Keypublic EdDSAParameterSpec getParams()
EdDSAKeypublic byte[] getSeed()
public byte[] getH()
public byte[] geta()
public GroupElement getA()
public byte[] getAbyte()
Copyright © 2016. All rights reserved.