hopenpgp-tools 0.0 → 0.0.1
raw patch · 3 files changed
+11/−15 lines, 3 filesdep ~hOpenPGP
Dependency ranges changed: hOpenPGP
Files
- hkt.hs +3/−6
- hokey.hs +4/−5
- hopenpgp-tools.cabal +4/−4
hkt.hs view
@@ -18,6 +18,7 @@ import Paths_hopenpgp_tools (version) import Codec.Encryption.OpenPGP.Fingerprint (eightOctetKeyID)+import Codec.Encryption.OpenPGP.KeyInfo (keySize, pkalgoAbbrev) import Codec.Encryption.OpenPGP.Types import Control.Applicative ((<$>),(<*>), optional) import Control.Lens ((^.))@@ -51,13 +52,9 @@ showKey :: TK -> IO () showKey key = putStrLn . unlines . execWriter $ do- tell [ "pub " ++ show (keysize (key^.tkPKP^.pubkey)) ++ (take 1 $ show $ key^.tkPKP^.pkalgo) ++ "/0x" ++ (show . eightOctetKeyID $ key^.tkPKP ) ]+ tell [ "pub " ++ show (keySize (key^.tkPKP^.pubkey)) ++ (pkalgoAbbrev $ key^.tkPKP^.pkalgo) ++ "/0x" ++ (show . eightOctetKeyID $ key^.tkPKP ) ] tell $ map (\(x,_) -> "uid " ++ x) (key^.tkUIDs)- tell $ map (\((PublicSubkeyPkt x),_,_) -> "sub " ++ show (keysize (x^.pubkey)) ++ (take 1 $ show $ x^.pkalgo) ++ "/0x" ++ (show . eightOctetKeyID $ x)) (key^.tkSubs)- where- keysize (RSAPubKey x) = RSA.public_size x * 8- keysize (DSAPubKey x) = bitcount . DSA.params_q . DSA.public_params $ x -- should go into lib- bitcount = (*8) . length . unfoldr (\x -> if x == 0 then Nothing else Just (True, x `shiftR` 8))+ tell $ map (\((PublicSubkeyPkt x),_,_) -> "sub " ++ show (keySize (x^.pubkey)) ++ (pkalgoAbbrev $ x^.pkalgo) ++ "/0x" ++ (show . eightOctetKeyID $ x)) (key^.tkSubs) data Options = Options { keyring :: String
hokey.hs view
@@ -18,6 +18,7 @@ import Paths_hopenpgp_tools (version) import Codec.Encryption.OpenPGP.Fingerprint (fingerprint, eightOctetKeyID)+import Codec.Encryption.OpenPGP.KeyInfo (keySize) import Codec.Encryption.OpenPGP.Types import Control.Applicative ((<$>),(<*>), optional) import Control.Lens ((^.), (^?!), ix)@@ -65,11 +66,9 @@ tell $ concatMap (\(x,ys) -> (" " ++ x ++ ":"):((map ((" "++) . show . kets) . filter (\x -> sigissuer x == Issuer (eoki key)) $ ys))) (key^.tkUIDs) tell $ concatMap (\(_,ys) -> (" <uat>:"):((map ((" "++) . show . kets) . filter (\x -> sigissuer x == Issuer (eoki key)) $ ys))) (key^.tkUAts) where- rsadsa2 = (key^.tkPKP^.pkalgo == RSA && rsasize >= 2048) ||- (key^.tkPKP^.pkalgo == DSA && dsasize >= 2048)- rsasize = (\(RSAPubKey x) -> RSA.public_size x) (key^.tkPKP^.pubkey) * 8- dsasize = (\(DSAPubKey x) -> bitcount . DSA.params_q . DSA.public_params $ x) (key^.tkPKP^.pubkey) -- should go into lib- bitcount = (*8) . length . unfoldr (\x -> if x == 0 then Nothing else Just (True, x `shiftR` 8))+ rsadsa2 = (key^.tkPKP^.pkalgo == RSA && keysize >= 2048) ||+ (key^.tkPKP^.pkalgo == DSA && keysize >= 2048)+ keysize = keySize (key^.tkPKP^.pubkey) sigissuer (SigV3 _ _ _ _ _ _ _) = OtherSigSub 666 B.empty -- this is dumb sigissuer (SigV4 _ _ _ _ xs _ _) = xs^?!ix 0^.sspPayload -- this is a horrible stack of stupid assumptions sigissuer (SigVOther _ _) = error "We're in the future."
hopenpgp-tools.cabal view
@@ -1,5 +1,5 @@ name: hopenpgp-tools-version: 0.0+version: 0.0.1 synopsis: hOpenPGP-based command-line tools description: command-line tools for performing some OpenPGP-related operations homepage: http://floss.scru.org/hopenpgp-tools@@ -20,7 +20,7 @@ , cereal , cereal-conduit , conduit- , hOpenPGP >= 0.7 && < 0.8+ , hOpenPGP >= 0.8 , openpgp-asciiarmor >= 0.1 , optparse-applicative , transformers@@ -36,7 +36,7 @@ , conduit , crypto-pubkey , directory- , hOpenPGP >= 0.7 && < 0.8+ , hOpenPGP >= 0.8 , ixset , lens , optparse-applicative@@ -53,7 +53,7 @@ , conduit , crypto-pubkey , directory- , hOpenPGP >= 0.7 && < 0.8+ , hOpenPGP >= 0.8 , ixset , lens , optparse-applicative