Skip to content

Commit

Permalink
Allow to use the SDK with ed25519 keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraino committed May 7, 2021
1 parent c1c9869 commit 26e7cc6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ca/tls.go
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"crypto"
"crypto/ecdsa"
"crypto/ed25519"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 26e7cc6

Please sign in to comment.