adding support for ed25519 public keys (#9703)
This commit is contained in:
parent
6de6f22929
commit
683db6821c
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto"
|
"crypto"
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
|
"crypto/ed25519"
|
||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
|
@ -307,9 +308,12 @@ func ParsePublicKeyPEM(data []byte) (interface{}, error) {
|
||||||
if ecPublicKey, ok := rawKey.(*ecdsa.PublicKey); ok {
|
if ecPublicKey, ok := rawKey.(*ecdsa.PublicKey); ok {
|
||||||
return ecPublicKey, nil
|
return ecPublicKey, nil
|
||||||
}
|
}
|
||||||
|
if edPublicKey, ok := rawKey.(ed25519.PublicKey); ok {
|
||||||
|
return edPublicKey, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, errors.New("data does not contain any valid RSA or ECDSA public keys")
|
return nil, errors.New("data does not contain any valid public keys")
|
||||||
}
|
}
|
||||||
|
|
||||||
// addPolicyIdentifiers adds certificate policies extension
|
// addPolicyIdentifiers adds certificate policies extension
|
||||||
|
|
Loading…
Reference in a new issue