aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGibheer <gibheer@gmail.com>2015-01-15 06:51:45 +0100
committerGibheer <gibheer@gmail.com>2015-01-15 06:51:45 +0100
commit7097d3b058faceabcfd33c7a024b779169d2a307 (patch)
tree5bb11fb7acb14d85492568488489824174f17f75
parent73a07e7665ceb5ea35b33091e286774e4f5ab04e (diff)
replace PrivateKey with crypto.Signer
-rw-r--r--main.go2
-rw-r--r--private_key.go10
-rw-r--r--sign_request.go2
3 files changed, 4 insertions, 10 deletions
diff --git a/main.go b/main.go
index 8329d47..dac1ee4 100644
--- a/main.go
+++ b/main.go
@@ -40,8 +40,6 @@ func main() {
func info_on_file() {}
// sign a certificate request to create a new certificate
func sign_request() {}
-// sign a message with a private key
-func sign_input() {}
// open stream for given path
func open_output_stream(path string) (io.WriteCloser, error) {
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))
diff --git a/sign_request.go b/sign_request.go
index 7c6381a..cc312ce 100644
--- a/sign_request.go
+++ b/sign_request.go
@@ -21,7 +21,7 @@ type (
DNSNames []string // alternative names to the BaseAttributes.CommonName
IPAddresses []net.IP // alternative IP addresses
- private_key PrivateKey
+ private_key crypto.Signer
output_stream io.Writer // the output stream for the CSR
}
)