0
0
Fork 0

replace PrivateKey with crypto.Signer

This commit is contained in:
Gibheer 2015-01-15 06:51:45 +01:00
parent 73a07e7665
commit 7097d3b058
3 changed files with 4 additions and 10 deletions

View File

@ -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) {

View File

@ -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))

View File

@ -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
}
)