diff options
Diffstat (limited to 'lib/SSHKey.hs')
-rw-r--r-- | lib/SSHKey.hs | 15 |
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 | ||
23 | type Key = (Integer,Integer) | 23 | type Key = (Integer,Integer) |
24 | 24 | ||
25 | |||
26 | sshrsa :: Integer -> Integer -> L.ByteString | ||
27 | sshrsa e n = runPut $ do | ||
28 | putWord32be 7 | ||
29 | putByteString "ssh-rsa" | ||
30 | put (LengthPrefixedBE e) | ||
31 | put (LengthPrefixedBE n) | ||
32 | |||
25 | keyblob :: Key -> L.ByteString | 33 | keyblob :: Key -> L.ByteString |
26 | keyblob (n,e) = "ssh-rsa " <> blob | 34 | keyblob (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 | |||
42 | blobkey :: L8.ByteString -> Maybe Key | 43 | blobkey :: L8.ByteString -> Maybe Key |
43 | blobkey bs = do | 44 | blobkey bs = do |
44 | let (pre,bs1) = L8.splitAt 7 bs | 45 | let (pre,bs1) = L8.splitAt 7 bs |