Returns the public key in its canonical encoding.
This implements the following specs:
-
General encoding: https://tools.ietf.org/html/draft-ietf-curdle-pkix-04
-
Key encoding: https://tools.ietf.org/html/rfc8032
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] Attributes OPTIONAL,
...,
[[2: publicKey [1] PublicKey OPTIONAL ]],
...
}
Version ::= INTEGER
PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
PrivateKey ::= OCTET STRING
PublicKey ::= OCTET 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 }