hopenpgp-tools 0.9.1 → 0.10
raw patch · 4 files changed
+21/−6 lines, 4 filesdep ~ansi-wl-pprintdep ~hOpenPGP
Dependency ranges changed: ansi-wl-pprint, hOpenPGP
Files
- HOpenPGP/Tools/ExpressionParsing.hs +12/−0
- hkt.hs +2/−1
- hopenpgp-tools.cabal +4/−3
- hot.hs +3/−2
HOpenPGP/Tools/ExpressionParsing.hs view
@@ -21,6 +21,7 @@ module HOpenPGP.Tools.ExpressionParsing (pPE) where import Codec.Encryption.OpenPGP.Types import Control.Applicative ((<$>), (<*>), (*>), (<|>), pure)+import Control.Monad (replicateM) import qualified Data.Attoparsec.Text as A import Data.Conduit.OpenPGP.Filter (conduitFilter, Expr(..), FilterPredicates(..), PKPPredicate(..), PKPVar(..), PKPOp(..), PKPValue(..), SPPredicate(..), SPVar(..), SPOp(..), SPValue(..), OPredicate(..), OVar(..), OOp(..), OValue(..)) @@ -56,6 +57,7 @@ <|> (A.string "pkalgo" *> pure PKPVPKA) <|> (A.string "keysize" *> pure PKPVKeysize) <|> (A.string "timestamp" *> pure PKPVTimestamp)+ <|> (A.string "fingerprint" *> pure PKPVTOF) pOpToken = (A.string "==" *> pure PKEquals) <|> (A.string "=" *> pure PKEquals) <|> (A.string "<" *> pure PKLessThan)@@ -66,7 +68,17 @@ <|> (A.asciiCI "ecdsa" *> pure (PKPPKA ECDSA)) <|> (A.asciiCI "ecdh" *> pure (PKPPKA ECDH)) <|> (A.asciiCI "dh" *> pure (PKPPKA DH))+ <|> (PKPTOF . read <$> fixedLengthHex 40)+ <|> (PKPEOKI . read <$> fixedLengthHex 16) <|> (PKPInt <$> hexordec) hexordec :: A.Parser Int hexordec = (A.string "0x" *> A.hexadecimal) <|> A.decimal++fixedLengthHex :: Int -> A.Parser String+fixedLengthHex len = (A.string "0x" *> flh len) <|> flh len+ where+ flh l = replicateM l (A.satisfy isHexDigit)+ isHexDigit c = (c >= '0' && c <= '9') ||+ (c >= 'a' && c <= 'f') ||+ (c >= 'A' && c <= 'F')
hkt.hs view
@@ -268,6 +268,8 @@ vreduce (PKPVPKA, p) = PKPPKA (_pkalgo p) vreduce (PKPVKeysize, p) = PKPInt (either (const 0) id . pubkeySize . _pubkey $ p) -- FIXME: this should be smarter vreduce (PKPVTimestamp, p) = PKPInt (fromIntegral (_timestamp p))+ vreduce (PKPVEOKI, p) = PKPEOKI (eightOctetKeyID p)+ vreduce (PKPVTOF, p) = PKPTOF (fingerprint p) kv DeprecatedV3 = 3 kv V4 = 4 @@ -285,4 +287,3 @@ hashAlgo (SigV4 _ _ x _ _ _ _) = x hashAlgo _ = error "V3 sig not supported here"-
hopenpgp-tools.cabal view
@@ -1,5 +1,5 @@ name: hopenpgp-tools-version: 0.9.1+version: 0.10 synopsis: hOpenPGP-based command-line tools description: command-line tools for performing some OpenPGP-related operations homepage: http://floss.scru.org/hopenpgp-tools@@ -18,6 +18,7 @@ other-modules: HOpenPGP.Tools.Common , HOpenPGP.Tools.ExpressionParsing build-depends: base > 4 && < 5+ , ansi-wl-pprint >= 0.6.7 , attoparsec >= 0.10.0.0 , bytestring , cereal@@ -81,7 +82,7 @@ , directory , fgl , graphviz- , hOpenPGP >= 1.4+ , hOpenPGP >= 1.6 , ixset , lens , optparse-applicative >= 0.10.0@@ -99,4 +100,4 @@ source-repository this type: git location: git://git.debian.org/users/clint/hopenpgp-tools.git- tag: hopenpgp-tools/0.9.1+ tag: hopenpgp-tools/0.10
hot.hs view
@@ -45,9 +45,10 @@ import System.IO (stdin, stderr, stdout, Handle, hFlush, hPutStrLn, hSetBuffering, BufferMode(..)) -import Options.Applicative.Builder (command, footer, header, help, info, long, metavar, option, eitherReader, prefs, progDesc, showHelpOnError, strOption, subparser)+import Options.Applicative.Builder (command, footer, header, help, helpDoc, info, long, metavar, option, eitherReader, prefs, progDesc, showHelpOnError, strOption, subparser) import Options.Applicative.Extra (customExecParser, helper) import Options.Applicative.Types (Parser)+import Text.PrettyPrint.ANSI.Leijen ((<+>), list, softline, text) data Command = DumpC | DeArmorC | ArmorC ArmoringOptions | FilterC FilteringOptions @@ -101,7 +102,7 @@ <$> optional (strOption (long "comment" <> metavar "COMMENT" <> help "ASCII armor Comment field")) <*> option (eitherReader armorTypeReader) (long "armor-type" <> metavar "ARMORTYPE" <> armortypeHelp) where- armortypeHelp = help $ "ASCII armor type " ++ show (map fst armorTypes)+ armortypeHelp = helpDoc . Just $ text "ASCII armor type" <> softline <> list (map (text . fst) armorTypes) foP :: Parser FilteringOptions foP = FilteringOptions