From 639a5379e9abf4a3f0d88464d1a229f8d5df14ae Mon Sep 17 00:00:00 2001 From: Gibheer Date: Wed, 18 Feb 2015 22:55:29 +0100 Subject: add sign and verification to ecdsa This commit adds support to sign and verify messages using ecdsa. --- types.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'types.go') diff --git a/types.go b/types.go index b05bd40..22c35d4 100644 --- a/types.go +++ b/types.go @@ -14,8 +14,10 @@ type ( PrivateKey interface { // derive a public key from the private key Public() PublicKey - // sign a message with the private key - Sign(message []byte) ([]byte, error) + // Sign a message using the public key and the given hash method. + // To use a hash method, include the package + // import _ "crypto/sha512" + Sign(message []byte, hash crypto.Hash) ([]byte, error) // return the private key structure privateKey() crypto.PrivateKey @@ -25,7 +27,7 @@ type ( PublicKey interface { Pemmer // use the public key to verify a message against a signature - Verify(message []byte, signature []byte) (bool, error) + Verify(message []byte, signature []byte, hash crypto.Hash) (bool, error) } Pemmer interface { -- cgit v1.2.3-70-g09d2