summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2013-12-13 01:51:57 -0500
committerjoe <joe@jerkface.net>2013-12-13 01:51:57 -0500
commite1bda6dbf5430c9bfbf91fc499b01b147db2bd8a (patch)
treead6c051dfec50fc9738bfe7f91362ce74a9ed28a
parent0559e24922c347f3c64a5baab7d864edf8f743ea (diff)
Updated ecc_curve to S.ByteString rather than [Word8]
-rw-r--r--kiki.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/kiki.hs b/kiki.hs
index 6c8ef10..baa187f 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -75,6 +75,8 @@ import Codec.Crypto.ECC.Base
75import Text.Printf 75import Text.Printf
76 76
77 77
78instance Default S.ByteString where def = S.empty
79
78isBitCoinKey p = 80isBitCoinKey p =
79 isKey p && key_algorithm p == ECDSA && ecc_curve p == oidToDER secp256k1_oid 81 isKey p && key_algorithm p == ECDSA && ecc_curve p == oidToDER secp256k1_oid
80 82
@@ -958,7 +960,7 @@ readKeyFromFile False "PEM" fname = do
958 ,('q',rsaP rsa) -- Note: p & q swapped 960 ,('q',rsaP rsa) -- Note: p & q swapped
959 ,('u',rsaCoefficient rsa) 961 ,('u',rsaCoefficient rsa)
960 ] 962 ]
961 , ecc_curve = [] 963 , ecc_curve = def
962 , s2k_useage = 0 964 , s2k_useage = 0
963 , s2k = S2K 100 "" 965 , s2k = S2K 100 ""
964 , symmetric_algorithm = Unencrypted 966 , symmetric_algorithm = Unencrypted
@@ -1557,7 +1559,7 @@ cannonical_eckey x y = 0x4:pad32(numToBytes x) ++ pad32(numToBytes y) :: [Word8]
1557 where 1559 where
1558 zlen = 32 - length xs 1560 zlen = 32 - length xs
1559 1561
1560oidToDER ns = b1 : concatMap encode ys :: [Word8] 1562oidToDER ns = S.pack $ b1 : concatMap encode ys
1561 where 1563 where
1562 (xs,ys) = splitAt 2 ns 1564 (xs,ys) = splitAt 2 ns
1563 b1 = fromIntegral $ foldl' (\a b->a*40+b) 0 xs 1565 b1 = fromIntegral $ foldl' (\a b->a*40+b) 0 xs