So far, I have:
key, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
if err != nil {
os.Exit(-1)
}
marshalled, err := x509.MarshalECPrivateKey(key) // marshalls data to byte stream
if err != nil {
os.Exit(-1)
}
Basically, what I am having trouble with has to do with the fact that when a key pair is generated, it is stored in an *ecdsa.PrivateKey
, in which the public key is stored in the *ecdsa.PrivateKey.PublicKey
, and when I marshall the key pair data (stored in the *ecdsa.PrivateKey
) using x509.MarshalECPrivateKey(key)
, a single byte slice is returned. I am therefore having trouble determining which are the public and private keys in the byte slice itself.