fix ed25519 key function
The private key for ed25519 never returned crypto.PrivateKey. This caused the generation of certificates to not work and may also have resulted in other issues.
This commit is contained in:
parent
d34a8ab26e
commit
0380f7f91c
|
@ -16,11 +16,20 @@ var (
|
|||
)
|
||||
|
||||
func TestCertificateCreation(t *testing.T) {
|
||||
pk, err := NewPrivateKeyEcdsa(elliptic.P224())
|
||||
ed25519Key, err := NewPrivateKeyEd25519()
|
||||
if err != nil {
|
||||
t.Errorf("cert: creating private key failed: %s", err)
|
||||
t.Errorf("cert: creating private key ed25519 failed: %s", err)
|
||||
}
|
||||
ecdsaKey, err := NewPrivateKeyEcdsa(elliptic.P224())
|
||||
if err != nil {
|
||||
t.Errorf("cert: creating private key ecdsa failed: %s", err)
|
||||
}
|
||||
rsaKey, err := NewPrivateKeyRsa(1024)
|
||||
if err != nil {
|
||||
t.Errorf("cert: creating private key rsa failed: %s", err)
|
||||
}
|
||||
|
||||
for _, pk := range []PrivateKey{rsaKey, ecdsaKey, ed25519Key} {
|
||||
csr, err := TestCertificateData.ToCertificateRequest(pk)
|
||||
if err != nil {
|
||||
t.Errorf("cert: creating csr failed: %s", err)
|
||||
|
@ -40,6 +49,7 @@ func TestCertificateCreation(t *testing.T) {
|
|||
if !fieldsAreSame(TestCertificateData, cert) {
|
||||
t.Errorf("cert: Fields are not the same")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fieldsAreSame(data CertificateData, cert *Certificate) bool {
|
||||
|
|
|
@ -45,9 +45,9 @@ func LoadPrivateKeyEd25519(raw []byte) (*Ed25519PrivateKey, error) {
|
|||
return &Ed25519PrivateKey{pr_loaded}, nil
|
||||
}
|
||||
|
||||
// TODO implement the raw API for the private key
|
||||
// PrivateKey returns the private key.
|
||||
func (pr *Ed25519PrivateKey) PrivateKey() crypto.PrivateKey {
|
||||
return nil
|
||||
return pr.private_key
|
||||
}
|
||||
|
||||
// Return the public key for this private key.
|
||||
|
|
Loading…
Reference in New Issue