aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2022-03-05 15:00:44 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2022-03-05 15:06:50 +0000
commit7e48c1f9584783e88650ef4a5b0f438748dd9032 (patch)
tree199bdd66f39a526848b6147e49440c6f8359d7d9 /main.go
parent42a9881b6905ee5ffc044d1f3f77dac2389ed521 (diff)
Use clearer return types for keys
Diffstat (limited to 'main.go')
-rw-r--r--main.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/main.go b/main.go
index 996b359..b28865f 100644
--- a/main.go
+++ b/main.go
@@ -6,6 +6,7 @@
package main
import (
+ "crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
@@ -285,7 +286,7 @@ func extKeyUsage() []x509.ExtKeyUsage {
return es
}
-func keyPair() (interface{}, interface{}, error) {
+func keyPair() (crypto.PrivateKey, crypto.PublicKey, error) {
switch keyAlgo {
case "ecdsa":
key, err := ecdsa.GenerateKey(elliptic.P384(), rand.Reader)
@@ -331,7 +332,7 @@ func newSerial() *big.Int {
return x.Add(x, big.NewInt(1))
}
-func parsePrivateKey(b *pem.Block) (interface{}, error) {
+func parsePrivateKey(b *pem.Block) (crypto.PrivateKey, error) {
switch b.Type {
case "EC PRIVATE KEY":
return x509.ParseECPrivateKey(b.Bytes)