From 34fb817a4a4cd2761ba35a2c94f9d0eb79d06244 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 6 Jul 2015 00:50:42 -0800 Subject: Fixing unit tests --- store/sql_store.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'store/sql_store.go') diff --git a/store/sql_store.go b/store/sql_store.go index bef8b4867..a0a1a9f23 100644 --- a/store/sql_store.go +++ b/store/sql_store.go @@ -8,9 +8,9 @@ import ( "crypto/aes" "crypto/cipher" "crypto/hmac" + crand "crypto/rand" "crypto/sha256" "crypto/sha512" - crand "crypto/rand" dbsql "database/sql" "encoding/base64" "encoding/json" @@ -362,21 +362,21 @@ func decrypt(key []byte, cryptoText string) (string, error) { ciphertext, err := base64.URLEncoding.DecodeString(cryptoText) if err != nil { - return "", err + return "", err } skey := sha512.Sum512(key) ekey, akey := skey[:32], skey[32:] macfn := hmac.New(sha256.New, akey) if len(ciphertext) < aes.BlockSize+macfn.Size() { - return "", errors.New("short ciphertext") + return "", errors.New("short ciphertext") } macfn.Write(ciphertext[aes.BlockSize+macfn.Size():]) expectedMac := macfn.Sum(nil) - mac := ciphertext[aes.BlockSize:aes.BlockSize+macfn.Size()] + mac := ciphertext[aes.BlockSize : aes.BlockSize+macfn.Size()] if hmac.Equal(expectedMac, mac) != true { - return "", errors.New("Incorrect MAC for the given ciphertext") + return "", errors.New("Incorrect MAC for the given ciphertext") } block, err := aes.NewCipher(ekey) -- cgit v1.2.3-1-g7c22