diff options
author | Gibheer <gibheer@gmail.com> | 2015-01-15 06:51:45 +0100 |
---|---|---|
committer | Gibheer <gibheer@gmail.com> | 2015-01-15 06:51:45 +0100 |
commit | 7097d3b058faceabcfd33c7a024b779169d2a307 (patch) | |
tree | 5bb11fb7acb14d85492568488489824174f17f75 /private_key.go | |
parent | 73a07e7665ceb5ea35b33091e286774e4f5ab04e (diff) |
replace PrivateKey with crypto.Signer
Diffstat (limited to 'private_key.go')
-rw-r--r-- | private_key.go | 10 |
1 files changed, 3 insertions, 7 deletions
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)) |