From 7097d3b058faceabcfd33c7a024b779169d2a307 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Thu, 15 Jan 2015 06:51:45 +0100 Subject: replace PrivateKey with crypto.Signer --- private_key.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'private_key.go') diff --git a/private_key.go b/private_key.go index 5e32ca8..25d7f55 100644 --- a/private_key.go +++ b/private_key.go @@ -16,10 +16,6 @@ import ( ) type ( - PrivateKey interface { - Public() crypto.PublicKey - } - CreateFlags struct { CryptType string // rsa or ecdsa CryptLength int // the bit length @@ -101,7 +97,7 @@ func parse_create_flags() CreateFlags { } // load the private key stored at `path` -func load_private_key(path string) PrivateKey { +func load_private_key(path string) crypto.Signer { if path == "" { crash_with_help(2, "No path to private key supplied!") } @@ -129,7 +125,7 @@ func load_private_key(path string) PrivateKey { } // parse rsa private key -func load_private_key_rsa(block *pem.Block) PrivateKey { +func load_private_key_rsa(block *pem.Block) crypto.Signer { key, err := x509.ParsePKCS1PrivateKey(block.Bytes) if err != nil { crash_with_help(3, fmt.Sprintf("Error parsing private key: %s", err)) @@ -138,7 +134,7 @@ func load_private_key_rsa(block *pem.Block) PrivateKey { } // parse ecdsa private key -func load_private_key_ecdsa(block *pem.Block) PrivateKey { +func load_private_key_ecdsa(block *pem.Block) crypto.Signer { key, err := x509.ParseECPrivateKey(block.Bytes) if err != nil { crash_with_help(3, fmt.Sprintf("Error parsing private key: %s", err)) -- cgit v1.2.3-70-g09d2