summaryrefslogtreecommitdiff
path: root/DNSKey.hs
diff options
context:
space:
mode:
Diffstat (limited to 'DNSKey.hs')
-rw-r--r--DNSKey.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/DNSKey.hs b/DNSKey.hs
index 5c71c16..03767cf 100644
--- a/DNSKey.hs
+++ b/DNSKey.hs
@@ -5,8 +5,7 @@ import Data.Binary.Get
5import Data.Binary.Put 5import Data.Binary.Put
6import Data.Bits 6import Data.Bits
7import qualified Data.ByteString as B 7import qualified Data.ByteString as B
8import qualified Data.ByteString.Lazy as L 8import Data.Int
9import Data.Word
10 9
11-- RSA n e 10-- RSA n e
12-- n = modulus 11-- n = modulus
@@ -14,6 +13,7 @@ import Data.Word
14data RSA = RSA Integer Integer 13data RSA = RSA Integer Integer
15 deriving (Eq,Show) 14 deriving (Eq,Show)
16 15
16getRSA :: Int64 -> Get RSA
17getRSA len = do 17getRSA len = do
18 elen <- do 18 elen <- do
19 tog <- get 19 tog <- get
@@ -27,6 +27,7 @@ getRSA len = do
27 n = snd $ B.foldl' (\(c,a) w8 -> (c-1, a + 256^c * fromIntegral w8)) (nlen-1,0) nbs 27 n = snd $ B.foldl' (\(c,a) w8 -> (c-1, a + 256^c * fromIntegral w8)) (nlen-1,0) nbs
28 return $ RSA n e 28 return $ RSA n e
29 29
30putRSA :: RSA -> PutM ()
30putRSA (RSA n e) = do 31putRSA (RSA n e) = do
31 if elen > 255 || elen==0 32 if elen > 255 || elen==0
32 then do 33 then do