packages feed

hopenpgp-tools 0.5 → 0.6

raw patch · 4 files changed

+17/−14 lines, 4 filesdep ~hOpenPGP

Dependency ranges changed: hOpenPGP

Files

HOpenPGP/Tools/Common.hs view
@@ -61,7 +61,7 @@ keyMatchesFingerprint :: Bool -> TK -> TwentyOctetFingerprint -> Bool keyMatchesFingerprint = keyMatchesPKPred fingerprint -keyMatchesEightOctetKeyId :: Bool -> TK -> EightOctetKeyId -> Bool+keyMatchesEightOctetKeyId :: Bool -> TK -> Either String EightOctetKeyId -> Bool -- FIXME: refactor this somehow keyMatchesEightOctetKeyId = keyMatchesPKPred eightOctetKeyID  keyMatchesExactUIDString :: String -> TK -> Bool
hkt.hs view
@@ -50,7 +50,7 @@ grabMatchingKeys fp filt srch = runResourceT $     CB.sourceFile fp $= conduitGet get $= conduitToTKsDropping $= CL.filter (if filt then filterMatch else matchAny) $$ CL.consume     where-        matchAny tk = either (const False) id $ fmap (keyMatchesFingerprint True tk) efp <|> fmap (keyMatchesEightOctetKeyId True tk) eeok <|> return (keyMatchesUIDSubString srch tk)+        matchAny tk = either (const False) id $ fmap (keyMatchesFingerprint True tk) efp <|> fmap (keyMatchesEightOctetKeyId True tk . Right) eeok <|> return (keyMatchesUIDSubString srch tk)         filterMatch tk = eval pkpEval (either error id (A.parseOnly pPE (T.pack srch))) (tk^.tkKey._1)         efp = parseFingerprint . T.pack $ srch         eeok = parseEightOctetKeyId . T.pack $ srch
hokey.hs view
@@ -154,7 +154,10 @@         sigissuer (SigVOther _ _) = error "We're in the future." -- FIXME         getIssuer i@(Issuer _) = Just i         getIssuer _ = Nothing-        eoki = eightOctetKeyID . fst . _tkKey+        eoki pkp+            | pkp^.keyVersion == V4 = hush . eightOctetKeyID $ pkp+            | pkp^.keyVersion == DeprecatedV3 && elem (pkp^.pkalgo) [RSA,DeprecatedRSASignOnly] = hush . eightOctetKeyID $ pkp+            | otherwise = Nothing         hashAlgo (SigV4 _ _ x _ _ _ _) = x         phas (SigV4 _ _ _ xs _ _ _) = colorizePHAs . concatMap (\(SigSubPacket _ (PreferredHashAlgorithms x)) -> x) $ filter isPHA xs         phas _ = Colored Nothing Nothing []@@ -165,7 +168,7 @@         isCT (SigSubPacket _ (SigCreationTime _)) = True         isCT _ = False         sigcts (SigV4 _ _ _ xs _ _ _) = map (\(SigSubPacket _ (SigCreationTime x)) -> x) $ filter isCT xs-        alleged = filter (\x -> sigissuer x == Just (Issuer (eoki key)))+        alleged = filter (\x -> ((==) <$> sigissuer x <*> fmap Issuer (eoki (key^.tkKey._1))) == Just True)         newest = take 1 . sortBy (comparing (Down . take 1 . sigcts)) -- FIXME: this is terrible         stripOtherSigs tk = tk {             _tkUIDs = map (second alleged) (_tkUIDs tk)@@ -208,11 +211,11 @@           <> linebreak <> indent 4 (text "Key expiration times" <> colon <+> mconcat (map ((linebreak <>) . indent 2 . coloredToColor list . fmap (map (text . keyExp ts))) (uidKeyExpirationTimes ur)))         keyExp ts ke = durationPrettyPrinter ke ++ " = " ++ formatTime defaultTimeLocale "%c" (posixSecondsToUTCTime (realToFrac ts + realToFrac ke)) -jsonReport :: POSIXTime -> [TK] -> BL.ByteString-jsonReport ps keys = A.encode (map (checkKey (Just ps)) keys)+jsonReport :: POSIXTime -> TK -> BL.ByteString+jsonReport ps = A.encode . checkKey (Just ps) -yamlReport :: POSIXTime -> [TK] -> B.ByteString-yamlReport ps keys = Y.encode (map (checkKey (Just ps)) keys)+yamlReport :: POSIXTime -> TK -> B.ByteString+yamlReport ps = Y.encode . (:[]) . checkKey (Just ps)  -- this does not have the same sense of calendar anyone else might durationPrettyPrinter :: TimeStamp -> String@@ -262,8 +265,8 @@     output (outputFormat o) cpt keys     where         output Pretty cpt = mapM_ (putDoc . prettyKeyReport cpt)-        output JSON cpt = BL.putStr . jsonReport cpt-        output YAML cpt = B.putStr . yamlReport cpt+        output JSON cpt = mapM_ (BL.putStr . flip BL.append (BL.singleton 0x0a) . jsonReport cpt)+        output YAML cpt = mapM_ (B.putStr . yamlReport cpt)  banner' :: Handle -> IO () banner' h = hPutStrLn h (banner "hokey" ++ "\n" ++ warranty "hokey")
hopenpgp-tools.cabal view
@@ -1,5 +1,5 @@ name:                hopenpgp-tools-version:             0.5+version:             0.6 synopsis:            hOpenPGP-based command-line tools description:         command-line tools for performing some OpenPGP-related operations homepage:            http://floss.scru.org/hopenpgp-tools@@ -48,7 +48,7 @@                ,       cryptohash             >= 0.7.7                ,       directory                ,       errors-               ,       hOpenPGP               >= 1.0.1+               ,       hOpenPGP               >= 1.2                ,       lens                ,       old-locale                ,       optparse-applicative   >= 0.5.0@@ -71,7 +71,7 @@                ,       conduit                ,       crypto-pubkey                ,       directory-               ,       hOpenPGP               >= 1.0.1+               ,       hOpenPGP               >= 1.2                ,       ixset                ,       lens                ,       optparse-applicative   >= 0.5.0@@ -86,4 +86,4 @@ source-repository this   type:     git   location: git://git.debian.org/users/clint/hopenpgp-tools.git-  tag:      hopenpgp-tools/0.5+  tag:      hopenpgp-tools/0.6