summaryrefslogtreecommitdiff
path: root/lib/SSHKey.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SSHKey.hs')
-rw-r--r--lib/SSHKey.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/SSHKey.hs b/lib/SSHKey.hs
index bd47169..0ded986 100644
--- a/lib/SSHKey.hs
+++ b/lib/SSHKey.hs
@@ -22,6 +22,14 @@ import LengthPrefixedBE
22 22
23type Key = (Integer,Integer) 23type Key = (Integer,Integer)
24 24
25
26sshrsa :: Integer -> Integer -> L.ByteString
27sshrsa e n = runPut $ do
28 putWord32be 7
29 putByteString "ssh-rsa"
30 put (LengthPrefixedBE e)
31 put (LengthPrefixedBE n)
32
25keyblob :: Key -> L.ByteString 33keyblob :: Key -> L.ByteString
26keyblob (n,e) = "ssh-rsa " <> blob 34keyblob (n,e) = "ssh-rsa " <> blob
27 where 35 where
@@ -32,13 +40,6 @@ keyblob (n,e) = "ssh-rsa " <> blob
32 blob = L8.pack $ Base64.encode (L.unpack bs) 40 blob = L8.pack $ Base64.encode (L.unpack bs)
33#endif 41#endif
34 42
35 sshrsa :: Integer -> Integer -> L.ByteString
36 sshrsa e n = runPut $ do
37 putWord32be 7
38 putByteString "ssh-rsa"
39 put (LengthPrefixedBE e)
40 put (LengthPrefixedBE n)
41
42blobkey :: L8.ByteString -> Maybe Key 43blobkey :: L8.ByteString -> Maybe Key
43blobkey bs = do 44blobkey bs = do
44 let (pre,bs1) = L8.splitAt 7 bs 45 let (pre,bs1) = L8.splitAt 7 bs