From e5275d82b9858d446b04efefb690da8553ee96d0 Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 15 Dec 2013 00:30:53 -0500 Subject: Migrated from OpenPGP-CryptoAPI to openpgp-util --- OpenPGP.hs | 44 -------------------------------------------- kiki.hs | 5 ++--- 2 files changed, 2 insertions(+), 47 deletions(-) delete mode 100644 OpenPGP.hs diff --git a/OpenPGP.hs b/OpenPGP.hs deleted file mode 100644 index 75054b3..0000000 --- a/OpenPGP.hs +++ /dev/null @@ -1,44 +0,0 @@ -module OpenPGP - ( verify - , fingerprint - , pgpSign - , decryptSecretKey - ) where - -import Data.OpenPGP as OpenPGP -import Data.OpenPGP.CryptoAPI (verify,fingerprint,sign,decryptSecretKey) -import Data.Time.Clock.POSIX -import Control.Applicative ( (<$>) ) -import Crypto.Random (newGenIO,SystemRandom) -import ControlMaybe - -now = floor <$> Data.Time.Clock.POSIX.getPOSIXTime - -stampit timestamp sig = sig { hashed_subpackets = hashed' } - where - hashed_stamps = filter isStamp (hashed_subpackets sig) - unhashed_stamps = filter isStamp (unhashed_subpackets sig) - hashed' = case hashed_stamps ++ unhashed_stamps of - [] -> SignatureCreationTimePacket (fromIntegral timestamp) - : hashed_subpackets sig - _ -> hashed_subpackets sig - isStamp (SignatureCreationTimePacket {}) = True - isStamp _ = False - --- | Make a signature --- --- In order to set more options on a signature, pass in a signature packet. -pgpSign :: - OpenPGP.Message -- ^ SecretKeys, one of which will be used - -> OpenPGP.SignatureOver -- ^ Data to sign, and optional signature packet - -> OpenPGP.HashAlgorithm -- ^ HashAlgorithm to use in signature - -> String -- ^ KeyID of key to choose - -> IO (Maybe OpenPGP.SignatureOver) -pgpSign seckeys dta hash_algo keyid = - handleIO_ (return Nothing) $ do - timestamp <- now - g <- newGenIO :: IO SystemRandom - let sigs = map (stampit timestamp) $ signatures_over dta - dta' = dta { signatures_over = sigs } - let (r,g') = sign seckeys dta' hash_algo keyid timestamp g - return (Just r) diff --git a/kiki.hs b/kiki.hs index 8e49086..ace9077 100644 --- a/kiki.hs +++ b/kiki.hs @@ -23,8 +23,7 @@ import Control.Monad import qualified Text.Show.Pretty as PP import Text.PrettyPrint as PP hiding ((<>)) import Data.List --- import Data.OpenPGP.CryptoAPI (verify,fingerprint,sign,decryptSecretKey) -import OpenPGP +import Data.OpenPGP.Util (verify,fingerprint,decryptSecretKey,pgpSign) import Data.Ord import Data.Maybe import Data.Bits @@ -714,7 +713,7 @@ expandPath path [] = [] readPacketsFromFile :: FilePath -> IO Message readPacketsFromFile fname = do - warn $ fname ++ ": reading..." + -- warn $ fname ++ ": reading..." input <- L.readFile fname return $ case decodeOrFail input of -- cgit v1.2.3