Преглед на файлове

Allow to use the SDK with ed25519 keys.

Mariano Cano преди 5 години
родител
ревизия
26e7cc6177
променени са 1 файла, в които са добавени 8 реда и са изтрити 0 реда
  1. 8 0
      ca/tls.go

+ 8 - 0
ca/tls.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"context"
 	"crypto"
 	"crypto"
 	"crypto/ecdsa"
 	"crypto/ecdsa"
+	"crypto/ed25519"
 	"crypto/rsa"
 	"crypto/rsa"
 	"crypto/tls"
 	"crypto/tls"
 	"crypto/x509"
 	"crypto/x509"
@@ -325,6 +326,13 @@ func getPEM(i interface{}) ([]byte, error) {
 		if err != nil {
 		if err != nil {
 			return nil, errors.Wrap(err, "error marshaling private key")
 			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:
 	default:
 		return nil, errors.Errorf("unsupported key type %T", i)
 		return nil, errors.Errorf("unsupported key type %T", i)
 	}
 	}