java.lang.Object
net.i2p.crypto.eddsa.EdDSAPublicKey
- All Implemented Interfaces:
Serializable, AsymmetricKey, BinaryEncodablePREVIEW, Key, PublicKey, EdDSAKey
An EdDSA public key.
For compatibility with older releases, decoding supports both RFC 8410 and an older draft specification.
Field Summary
Fields inherited from interface EdDSAKey
KEY_ALGORITHMConstructor Summary
ConstructorsConstructorDescriptionCreate from X.509.Takes the public point A and its curve parameters from the spec.Method Summary
All MethodsModifier and TypeMethodDescriptionbooleanWhether this key is equal to the given key.getA()The public key point A.byte[]getAbyte()The encoded public key.The reported algorithm name for all EdDSA keys.byte[]Returns the public key in its canonical encoding.The encoding format of the key.The negated public key point.The EdDSA domain parameters for the key.inthashCode()Hash code of the public key bytes, for use in hash tables.
Constructor Details
EdDSAPublicKey
Takes the public point A and its curve parameters from the spec.- Parameters:
spec- the public key specification
EdDSAPublicKey
Create from X.509.- Parameters:
spec- the X.509 key specification- Throws:
InvalidKeySpecException- if the spec is invalid
Method Details
getAlgorithm
The reported algorithm name for all EdDSA keys.- Specified by:
getAlgorithmin interfaceKey- Returns:
- the JCA algorithm name shared by all EdDSA keys, "EdDSA"
getFormat
getEncoded
public byte[] getEncoded()Returns the public key in its canonical encoding.This implements the following specs:
For keys in older formats, decoding and then re-encoding is sufficient to migrate them to the canonical encoding.
Relevant spec quotes:
In the X.509 certificate, the subjectPublicKeyInfo field has the SubjectPublicKeyInfo type, which has the following ASN.1 syntax: SubjectPublicKeyInfo ::= SEQUENCE { algorithm AlgorithmIdentifier, subjectPublicKey BIT 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 }- Specified by:
getEncodedin interfaceKey- Returns:
- 44 bytes for Ed25519, null for other curves
getParams
The EdDSA domain parameters for the key.- Specified by:
getParamsin interfaceAsymmetricKey- Specified by:
getParamsin interfaceEdDSAKey- Returns:
- the EdDSAParameterSpec naming the curve and hash algorithm
getA
getNegativeA
The negated public key point.- Returns:
- The negated public key point.
getAbyte
public byte[] getAbyte()The encoded public key.- Returns:
- The public key bytes.
hashCode
equals