diff options
author | joe <joe@jerkface.net> | 2016-08-27 04:29:39 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2016-08-27 04:29:39 -0400 |
commit | a15059b0452ba9d730404ce5c5a6b91a3828fdbc (patch) | |
tree | 0f9617558352dcb3e2ea6219cfa1d7f739b8d761 /lib/Kiki.hs | |
parent | 067c3647ed02c24c08b17803e28679e69d2e6dd9 (diff) |
Replaced dataenc with memory.
Diffstat (limited to 'lib/Kiki.hs')
-rw-r--r-- | lib/Kiki.hs | 11 |
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 | |||
26 | import System.Process | 26 | import System.Process |
27 | import System.Posix.Files | 27 | import System.Posix.Files |
28 | import qualified Data.Traversable as T (mapM) | 28 | import qualified Data.Traversable as T (mapM) |
29 | #if defined(VERSION_memory) | ||
30 | import qualified Data.ByteString.Char8 as S8 | ||
31 | import Data.ByteArray.Encoding | ||
32 | #elif defined(VERSION_dataenc) | ||
29 | import qualified Codec.Binary.Base64 as Base64 | 33 | import qualified Codec.Binary.Base64 as Base64 |
34 | #endif | ||
30 | import qualified Data.ByteString.Lazy as L | 35 | import qualified Data.ByteString.Lazy as L |
31 | import qualified Data.ByteString.Lazy.Char8 as Char8 | 36 | import qualified Data.ByteString.Lazy.Char8 as Char8 |
32 | import qualified Data.Map.Strict as Map | 37 | import 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 = | |||
452 | pemFromPacket k = do | 457 | pemFromPacket 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 | ||