Allow to use the SDK with ed25519 keys.

This commit is contained in:
Mariano Cano 2021-05-06 18:10:12 -07:00
parent c1c986922b
commit 26e7cc6177

View file

@ -4,6 +4,7 @@ import (
"context"
"crypto"
"crypto/ecdsa"
"crypto/ed25519"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
@ -325,6 +326,13 @@ func getPEM(i interface{}) ([]byte, error) {
if err != nil {
return nil, errors.Wrap(err, "error marshaling private key")
}
case ed25519.PrivateKey:
var err error
block.Type = "PRIVATE KEY"
block.Bytes, err = x509.MarshalPKCS8PrivateKey(i)
if err != nil {
return nil, errors.Wrap(err, "error marshaling private key")
}
default:
return nil, errors.Errorf("unsupported key type %T", i)
}