summaryrefslogtreecommitdiff
path: root/lib/Kiki.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2016-08-27 04:29:39 -0400
committerjoe <joe@jerkface.net>2016-08-27 04:29:39 -0400
commita15059b0452ba9d730404ce5c5a6b91a3828fdbc (patch)
tree0f9617558352dcb3e2ea6219cfa1d7f739b8d761 /lib/Kiki.hs
parent067c3647ed02c24c08b17803e28679e69d2e6dd9 (diff)
Replaced dataenc with memory.
Diffstat (limited to 'lib/Kiki.hs')
-rw-r--r--lib/Kiki.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Kiki.hs b/lib/Kiki.hs
index ef7b913..a134680 100644
--- a/lib/Kiki.hs
+++ b/lib/Kiki.hs
@@ -26,7 +26,12 @@ import System.Posix.User
26import System.Process 26import System.Process
27import System.Posix.Files 27import System.Posix.Files
28import qualified Data.Traversable as T (mapM) 28import qualified Data.Traversable as T (mapM)
29#if defined(VERSION_memory)
30import qualified Data.ByteString.Char8 as S8
31import Data.ByteArray.Encoding
32#elif defined(VERSION_dataenc)
29import qualified Codec.Binary.Base64 as Base64 33import qualified Codec.Binary.Base64 as Base64
34#endif
30import qualified Data.ByteString.Lazy as L 35import qualified Data.ByteString.Lazy as L
31import qualified Data.ByteString.Lazy.Char8 as Char8 36import qualified Data.ByteString.Lazy.Char8 as Char8
32import qualified Data.Map.Strict as Map 37import qualified Data.Map.Strict as Map
@@ -146,7 +151,7 @@ importAndRefresh root cmn = do
146 ( encode $ Message [mk { is_subkey = False }] ) 151 ( encode $ Message [mk { is_subkey = False }] )
147 -} 152 -}
148 master_un <- (\k -> k { is_subkey = False }) <$> generateKey (GenRSA $ 4096 `div` 8 ) 153 master_un <- (\k -> k { is_subkey = False }) <$> generateKey (GenRSA $ 4096 `div` 8 )
149 let default_cipher = (CAST5, IteratedSaltedS2K SHA1 4073382889203176146 7864320) 154 let default_cipher = (CAST5 {- AES128 -}, IteratedSaltedS2K SHA1 4073382889203176146 7864320)
150 ctx = InputFileContext secring pubring 155 ctx = InputFileContext secring pubring
151 passwordop = KeyRingOperation 156 passwordop = KeyRingOperation
152 { opFiles = Map.empty 157 { opFiles = Map.empty
@@ -452,7 +457,11 @@ sortOn f =
452pemFromPacket k = do 457pemFromPacket k = do
453 let rsa = pkcs8 . fromJust $ rsaKeyFromPacket k 458 let rsa = pkcs8 . fromJust $ rsaKeyFromPacket k
454 der = encodeASN1 DER (toASN1 rsa []) 459 der = encodeASN1 DER (toASN1 rsa [])
460#if defined(VERSION_memory)
461 qq = S8.unpack $ convertToBase Base64 (L.toStrict der)
462#elif defined(VERSION_dataenc)
455 qq = Base64.encode (L.unpack der) 463 qq = Base64.encode (L.unpack der)
464#endif
456 return $ 465 return $
457 writePEM "PUBLIC KEY" qq -- ("TODO "++show keyspec) 466 writePEM "PUBLIC KEY" qq -- ("TODO "++show keyspec)
458 467