packages feed

hopenpgp-tools 0.26.1 → 0.26.2

raw patch · 3 files changed

+638/−320 lines, 3 filesdep ~hOpenPGP

Dependency ranges changed: hOpenPGP

Files

HOpenPGP/Tools/Common/TKUtils.hs view
@@ -59,6 +59,10 @@             first                 renderVerificationError                 (SomeSecretTK <$> verifyTKWith vsf mt secretTk)+        SomeMixedTK mixedTk ->+            first+                renderVerificationError+                (SomeMixedTK <$> verifyTKWith vsf mt mixedTk)     pure verifiedStk   where     vsf =@@ -78,8 +82,10 @@     strippedStk = stripOlderSigs (stripOtherSigs stk)     stripOtherSigs (SomePublicTK tk) = SomePublicTK (stripOtherSigsTK tk)     stripOtherSigs (SomeSecretTK tk) = SomeSecretTK (stripOtherSigsTK tk)+    stripOtherSigs (SomeMixedTK tk) = SomeMixedTK (stripOtherSigsTK tk)     stripOlderSigs (SomePublicTK tk) = SomePublicTK (stripOlderSigsTK tk)     stripOlderSigs (SomeSecretTK tk) = SomeSecretTK (stripOlderSigsTK tk)+    stripOlderSigs (SomeMixedTK tk) = SomeMixedTK (stripOlderSigsTK tk)     stripOtherSigsTK tk =         tk             { _tkUIDs = map (second alleged) (_tkUIDs tk)
hop.hs view
@@ -46,7 +46,10 @@     , recipientEncryptionTargetWithStrategyTyped     ) import Codec.Encryption.OpenPGP.Expirations-    ( effectiveKeyPreferencesAt+    ( effectiveKeyFlagsAt+    , effectiveKeyPreferencesAt+    , effectiveSubkeyFlagsAt+    , isPKTimeValidWithSelfSignatures     , isTKTimeValid     ) import Codec.Encryption.OpenPGP.Fingerprint@@ -67,6 +70,9 @@     , setSEIPDv1SymmetricPreferences     ) import Codec.Encryption.OpenPGP.KeyInfo (pubkeySize)+import Codec.Encryption.OpenPGP.KeyringParser+    ( parseMixedTKsWithWireRep+    ) import Codec.Encryption.OpenPGP.Message     ( EncryptMessageOptions (..)     , RecoveredSessionMaterial (..)@@ -79,6 +85,7 @@     ( isKUF     , isPKBindingSig     , isSKBindingSig+    , isSubkeyRevocation     ) import Codec.Encryption.OpenPGP.Policy     ( defaultDecryptPolicy@@ -109,6 +116,7 @@     ) import Codec.Encryption.OpenPGP.Serialize     ( parsePkts+    , parsePktsWithWireRep     , putSKeyForPKPayload     ) import Codec.Encryption.OpenPGP.Signatures@@ -259,6 +267,7 @@     , SignError (..)     , SignaturePayload (SigV3, SigV4, SigV6, SigVOther)     , SignatureSalt (..)+    , SomeKeyPkt (..)     , SomePKPayload (..)     , SomeTK (SomeMixedTK, SomePublicTK, SomeSecretTK)     , SymmetricAlgorithm@@ -272,7 +281,7 @@         , TripleDES         )     , TK (..)-    , TKKind (SecretTK)+    , TKKind (MixedTK, SecretTK)     , ThirtyTwoBitDuration (..)     , ThirtyTwoBitTimeStamp (..)     , UserAttrSubPacket@@ -283,6 +292,9 @@     , fromFVal     , keyPktPKPayload     , keyPktToPkt+    , mkPrimaryKeyPkt+    , mkSubkeyKeyPkt+    , mkWireRepRef     , modifyTKSecretKeys     , publicViewTK     , renderCompressionError@@ -292,6 +304,9 @@     , renderSecretKeyError     , renderSerializeError     , renderSignError+    , secretKeyPktSKAddendum+    , someKeyPktMaybeSKAddendum+    , someKeyPktPKPayload     , someTKToPublicViewTK     , someTKToSecretTK     , tkSecretKeyPairs@@ -322,7 +337,7 @@     , throwIO     ) import Control.Lens ((^..))-import Control.Monad (forM, forM_, unless, when, (>=>))+import Control.Monad (forM, forM_, guard, unless, when, (>=>)) import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.State.Lazy () import Control.Monad.Trans.Except ()@@ -1484,6 +1499,89 @@                         modifyTKSecretKeys tk $                             \pkp ska -> (pkp, fromMaybe ska (lookup pkp index)) +modifyMixedTKSecretKeysM+    :: Monad m+    => TK 'MixedTK+    -> (SomePKPayload -> SKAddendum -> m SKAddendum)+    -> m (TK 'MixedTK)+modifyMixedTKSecretKeysM tk cb = do+    primary' <- modifyPrimary (_tkPrimaryKey tk)+    subs' <- mapM modifySubkey (_tkSubs tk)+    pure tk {_tkPrimaryKey = primary', _tkSubs = subs'}+  where+    modifyPrimary skp =+        case someKeyPktMaybeSKAddendum skp of+            Nothing -> pure skp+            Just ska -> do+                let pkp = someKeyPktPKPayload skp+                ska' <- cb pkp ska+                pure (mkPrimaryKeyPkt pkp (Just ska'))+    modifySubkey (skp, sigs) = do+        skp' <-+            case someKeyPktMaybeSKAddendum skp of+                Nothing -> pure skp+                Just ska -> do+                    let pkp = someKeyPktPKPayload skp+                    ska' <- cb pkp ska+                    pure (mkSubkeyKeyPkt pkp (Just ska'))+        pure (skp', sigs)++modifyMixedTKSecretKeysE+    :: TK 'MixedTK+    -> (SomePKPayload -> SKAddendum -> IO (Either String SKAddendum))+    -> IO (Either String (TK 'MixedTK))+modifyMixedTKSecretKeysE tk cb = do+    let keys =+            [ (someKeyPktPKPayload skp, ska)+            | skp <- _tkPrimaryKey tk : map fst (_tkSubs tk)+            , Just ska <- [someKeyPktMaybeSKAddendum skp]+            ]+    result <- mapM (uncurry cb) keys+    case sequence result of+        Left err -> pure (Left err)+        Right skas -> do+            let index = zip (map fst keys) skas+                lookupSka pkp ska = fromMaybe ska (lookup pkp index)+            primary' <- modifyPrimary (_tkPrimaryKey tk) lookupSka+            subs' <- mapM (modifySubkey lookupSka) (_tkSubs tk)+            pure (Right tk {_tkPrimaryKey = primary', _tkSubs = subs'})+  where+    modifyPrimary skp lookupSka =+        case someKeyPktMaybeSKAddendum skp of+            Nothing -> pure skp+            Just ska -> do+                let pkp = someKeyPktPKPayload skp+                pure (mkPrimaryKeyPkt pkp (Just (lookupSka pkp ska)))+    modifySubkey lookupSka (skp, sigs) = do+        skp' <-+            case someKeyPktMaybeSKAddendum skp of+                Nothing -> pure skp+                Just ska -> do+                    let pkp = someKeyPktPKPayload skp+                    pure (mkSubkeyKeyPkt pkp (Just (lookupSka pkp ska)))+        pure (skp', sigs)++modifySomeTKSecretKeysM+    :: Monad m+    => (SomePKPayload -> SKAddendum -> m SKAddendum)+    -> SomeTK+    -> m SomeTK+modifySomeTKSecretKeysM cb stk =+    case stk of+        SomePublicTK tk -> pure (SomePublicTK tk)+        SomeSecretTK tk -> SomeSecretTK <$> modifyTKSecretKeysM tk cb+        SomeMixedTK tk -> SomeMixedTK <$> modifyMixedTKSecretKeysM tk cb++modifySomeTKSecretKeysE+    :: (SomePKPayload -> SKAddendum -> IO (Either String SKAddendum))+    -> SomeTK+    -> IO (Either String SomeTK)+modifySomeTKSecretKeysE cb stk =+    case stk of+        SomePublicTK tk -> pure (Right (SomePublicTK tk))+        SomeSecretTK tk -> fmap SomeSecretTK <$> modifyTKSecretKeysE tk cb+        SomeMixedTK tk -> fmap SomeMixedTK <$> modifyMixedTKSecretKeysE tk cb+ data KeyGenProfile     = KeyGenRFC9580     | KeyGenRFC4880@@ -1701,6 +1799,130 @@     lbs <- loadInputFromFile context "file" path     decodeOpenPGPInput path lbs +-- FIXME: these should move to TKUtils.hs and get refactored+loadKEYSFromFile :: String -> FilePath -> IO [SomeTK]+loadKEYSFromFile context path = do+    lbs <- loadInputFromFile context "file" path+    decodeKEYSInput context path lbs++loadKEYSFromStdin :: String -> IO [SomeTK]+loadKEYSFromStdin context = do+    input <- runConduitRes $ CB.sourceHandle stdin .| CC.sinkLazy+    decodeKEYSInput context "standard input" input++decodeKEYSInput+    :: String -> FilePath -> BL.ByteString -> IO [SomeTK]+decodeKEYSInput context path input = do+    decodedArmors <-+        decodeAsciiArmorInput ("OpenPGP input in " ++ path) input+    (payload, wasArmored) <-+        case decodedArmors of+            Just armors ->+                case firstBy isOpenPGPArmorBlock armors of+                    Just (Armor _ _ bs) -> pure (bs, True)+                    _ ->+                        case firstBy isClearSignedArmor armors of+                            Just _ ->+                                failWith+                                    BadData+                                    ( "Expected key data in "+                                        ++ path+                                        ++ ", got cleartext signature"+                                    )+                            Nothing -> pure (input, False)+            Nothing -> pure (input, False)+    let ref = mkWireRepRef (Just (T.pack path)) wasArmored payload+        compute = do+            let pktWithWireReps = parsePktsWithWireRep ref payload+                parsed =+                    if null pktWithWireReps+                        then []+                        else+                            map+                                classifyMixedTK+                                (parseMixedTKsWithWireRep False pktWithWireReps)+                fallback =+                    if null parsed+                        then signingFallbackTKs (parsePkts payload)+                        else parsed+            _ <- evaluate (length pktWithWireReps)+            _ <- evaluate (length parsed)+            _ <- evaluate (length fallback)+            pure fallback+    fallback <- compute `catch` parseFailure+    when (null fallback) $+        failWith+            BadData+            (context ++ ": no OpenPGP key material found in " ++ path)+    pure fallback+  where+    parseFailure :: SomeException -> IO [SomeTK]+    parseFailure err =+        failWith+            BadData+            ( context+                ++ ": failed to parse key material in "+                ++ path+                ++ ": "+                ++ displayException err+            )++classifyMixedTK :: TK 'MixedTK -> SomeTK+classifyMixedTK tk =+    case mixedToSecretTK tk of+        Just secretTk -> SomeSecretTK secretTk+        Nothing+            | mixedTKHasSecretMaterial tk -> SomeMixedTK tk+            | otherwise ->+                SomePublicTK (someTKToPublicViewTK (SomeMixedTK tk))++mixedToSecretTK :: TK 'MixedTK -> Maybe (TK 'SecretTK)+mixedToSecretTK tk = do+    primary <-+        case _tkPrimaryKey tk of+            SomeKeyPkt kp@KeyPktSecretPrimary {} -> Just kp+            _ -> Nothing+    subs <- mapM secretSubkey (_tkSubs tk)+    pure+        TK+            { _tkPrimaryKey = primary+            , _tkRevs = _tkRevs tk+            , _tkDirectKeySigs = _tkDirectKeySigs tk+            , _tkUIDs = _tkUIDs tk+            , _tkUAts = _tkUAts tk+            , _tkSubs = subs+            }+  where+    secretSubkey+        :: (SomeKeyPkt, [SignaturePayload])+        -> Maybe (KeyPkt 'SecretPkt, [SignaturePayload])+    secretSubkey (skp, sigs) =+        case skp of+            SomeKeyPkt kp@KeyPktSecretSubkey {} -> Just (kp, sigs)+            _ -> Nothing++mixedTKHasSecretMaterial :: TK 'MixedTK -> Bool+mixedTKHasSecretMaterial tk =+    any+        (isJust . someKeyPktMaybeSKAddendum)+        (_tkPrimaryKey tk : map fst (_tkSubs tk))++someTKHasSecretMaterial :: SomeTK -> Bool+someTKHasSecretMaterial (SomePublicTK _) = False+someTKHasSecretMaterial (SomeSecretTK _) = True+someTKHasSecretMaterial (SomeMixedTK tk) = mixedTKHasSecretMaterial tk++someTKPrimarySecretKeyPkt :: SomeTK -> Maybe (KeyPkt 'SecretPkt)+someTKPrimarySecretKeyPkt (SomeSecretTK tk) =+    case _tkPrimaryKey tk of+        kp@KeyPktSecretPrimary {} -> Just kp+        _ -> Nothing+someTKPrimarySecretKeyPkt (SomeMixedTK tk) =+    case _tkPrimaryKey tk of+        SomeKeyPkt kp@KeyPktSecretPrimary {} -> Just kp+        _ -> Nothing+someTKPrimarySecretKeyPkt _ = Nothing+ normalizeHumanReadablePassword     :: String -> String -> B.ByteString -> IO Passphrase normalizeHumanReadablePassword context optionName passwordBytes =@@ -1816,16 +2038,12 @@ changeTKPassword     :: [Passphrase]     -> Maybe Passphrase-    -> TK 'SecretTK-    -> IO (Either String (TK 'SecretTK))-changeTKPassword oldPasswords mNewPassword tk = do-    result <--        modifyTKSecretKeysE-            tk-            (changeSKAddendum oldPasswords mNewPassword)-    case result of-        Left err -> pure (Left err)-        Right tk' -> pure (Right tk')+    -> SomeTK+    -> IO (Either String SomeTK)+changeTKPassword oldPasswords mNewPassword tk =+    modifySomeTKSecretKeysE+        (changeSKAddendum oldPasswords mNewPassword)+        tk   where     changeSKAddendum         :: [Passphrase]@@ -1938,48 +2156,42 @@  doExtractCert :: ExtractCertOptions -> IO () doExtractCert ExtractCertOptions {..} = do-    kbs <- runConduitRes $ CB.sourceHandle stdin .| CL.consume-    let lbs = BL.fromChunks kbs-    pkts <- decodeOpenPGPInput "stdin" lbs-    tks <--        runConduitRes $-            CL.sourceList pkts-                .| conduitToSomeTKsDroppingEither-                .| conduitDropErrorsAndNothings-                .| CC.sinkList+    tks <- loadKEYSFromStdin "extract-cert"     when (null tks) $         failWith-            MissingInput+            BadData             "extract-cert: no transferable secret key found on standard input"-    let output = runPut $ mapM_ (Bin.put . pubToSecret) tks+    forM_ tks $ \tk ->+        unless (someTKHasSecretMaterial tk) $+            failWith+                BadData+                ( "extract-cert: standard input contains certificate "+                    ++ describeKey tk+                    ++ " without secret key material; KEYS must be a transferable secret key"+                )+    let output = runPut $ mapM_ (Bin.put . toPublic) tks     BL.putStr $         if not ecNoArmor             then AA.encodeLazy [Armor ArmorPublicKeyBlock [] output]             else output   where-    pubToSecret tk =-        case tk of-            SomeSecretTK _ -> SomePublicTK (someTKToPublicViewTK tk)-            SomePublicTK publicTk -> SomePublicTK publicTk+    toPublic tk = SomePublicTK (someTKToPublicViewTK tk)  doChangeKeyPassword :: ChangeKeyPasswordOptions -> IO () doChangeKeyPassword ChangeKeyPasswordOptions {..} = do-    input <- runConduitRes $ CB.sourceHandle stdin .| CC.sinkLazy-    packets <- decodeOpenPGPInput "stdin" input-    tks <--        runConduitRes $-            CL.sourceList packets-                .| conduitToSomeTKsDroppingEither-                .| conduitDropErrorsAndNothings-                .| CC.sinkList+    tks <- loadKEYSFromStdin "change-key-password"     when (null tks) $         failWith-            MissingInput+            BadData             "change-key-password: no transferable secret key found on standard input"-    when (any (not . hasSecretKeyMaterial) tks) $-        failWith-            MissingInput-            "change-key-password: expected transferable secret key input on standard input"+    forM_ tks $ \tk ->+        unless (someTKHasSecretMaterial tk) $+            failWith+                BadData+                ( "change-key-password: standard input contains certificate "+                    ++ describeKey tk+                    ++ " without secret key material; KEYS must be a transferable secret key"+                )     oldPasswordsRaw <-         loadPasswordFiles             "change-key-password"@@ -1991,13 +2203,7 @@                 (concatMap (passwordRetryCandidates . BL.toStrict) oldPasswordsRaw)     newPassword <-         parseChangeKeyPasswordNewPassword changeKeyPasswordNewPassword-    let changeSome (SomePublicTK pk) = pure (Right (SomePublicTK pk))-        changeSome (SomeSecretTK sk) = do-            er <- changeTKPassword oldPasswords newPassword sk-            case er of-                Left err -> pure (Left err)-                Right tk' -> pure (Right (SomeSecretTK tk'))-    changed <- mapM changeSome tks+    changed <- mapM (changeTKPassword oldPasswords newPassword) tks     case sequence changed of         Left err ->             failWith@@ -2025,22 +2231,6 @@                     . BL.toStrict             ) -hasSecretKeyMaterial :: SomeTK -> Bool-hasSecretKeyMaterial tk =-    case tk of-        SomeSecretTK _ -> True-        SomePublicTK _ -> False--onlySecretTKs :: [SomeTK] -> [TK 'SecretTK]-onlySecretTKs =-    mapMaybe-        ( \t -> case t of SomeSecretTK tk -> Just tk; SomePublicTK _ -> Nothing-        )--secretTKFromSome :: SomeTK -> TK 'SecretTK-secretTKFromSome (SomeSecretTK tk) = tk-secretTKFromSome SomePublicTK {} = error "secretTKFromSome: expected secret key"- onSecretTKM     :: Monad m     => (TK 'SecretTK -> m (TK 'SecretTK)) -> SomeTK -> m SomeTK@@ -2162,7 +2352,7 @@ signatureSubpackets _ = []  doCertifyUserId :: POSIXTime -> CertifyUserIdOptions -> IO ()-doCertifyUserId _cpt CertifyUserIdOptions {..} = do+doCertifyUserId cpt CertifyUserIdOptions {..} = do     signerPasswordsRaw <-         loadPasswordFiles             "certify-userid"@@ -2176,16 +2366,32 @@                     signerPasswordsRaw                 )     signerTks <--        concat-            <$> mapM-                ( \p ->-                    loadCertifySignerTKsFromFile signerPasswords "certify-userid" p-                )-                certifyUserIdSignerFiles+        loadSigningKeys+            "certify-userid"+            certifyUserIdSignerFiles+            signerPasswords     when (null signerTks) $         failWith             MissingInput-            "certify-userid: no signer certificate found"+            "certify-userid: no signer key found"+    certSigners <-+        forM signerTks $ \(path, stk) -> do+            (_, normalized) <-+                normalizeSomeKeyMaterial+                    "certify-userid"+                    cpt+                    (path, stk)+            case certificationPrimaryKeyAt cpt normalized of+                Just kp -> pure (path, kp)+                Nothing ->+                    failWith+                        KeyCannotCertify+                        ( "certify-userid: key "+                            ++ describeKey normalized+                            ++ " in "+                            ++ path+                            ++ " cannot produce a certification"+                        )     input <- runConduitRes $ CB.sourceHandle stdin .| CC.sinkLazy     certPkts <- decodeOpenPGPInput "standard input" input     rejectSecretKeyPackets "certify-userid" "standard input" certPkts@@ -2208,7 +2414,7 @@                     targetTk                     targetUserIds                     requireSelfSig-                    signerTks+                    certSigners             )             targetTks     let output = runPut (mapM_ Bin.put updatedTargets)@@ -2217,42 +2423,46 @@             then output             else AA.encodeLazy [Armor ArmorPublicKeyBlock [] output] -loadCertifySignerTKsFromFile-    :: [Passphrase] -> String -> String -> IO [TK 'SecretTK]-loadCertifySignerTKsFromFile signerPasswords context path = do-    lbs <- loadInputFromFile context "file" path-    packets <- decodeOpenPGPInput path lbs-    tks <--        runConduitRes $-            CL.sourceList packets-                .| conduitToSomeTKsDroppingEither-                .| conduitDropErrorsAndNothings-                .| CC.sinkList-    let fallbackTks = signingFallbackTKs packets-    when (null tks && null fallbackTks) $-        failWith-            MissingInput-            ("certify-userid: no signer key material found in " ++ path)-    let secretTks =-            if null tks-                then map secretTKFromSome fallbackTks-                else onlySecretTKs tks-    mapM-        ( \tk -> do-            tk' <--                unlockTransferableSecretKeyMaterial-                    "certify-userid failed"-                    path-                    "--with-key-password"-                    signerPasswords-                    tk-            pure tk'-        )-        secretTks+{- | The primary key that would be used to issue a certification, if the+transferable key has usable secret certification material.+-}+certificationPrimaryKeyAt+    :: POSIXTime -> SomeTK -> Maybe (KeyPkt 'SecretPkt)+certificationPrimaryKeyAt pt stk = do+    kp <- someTKPrimarySecretKeyPkt stk+    let publicView = someTKToPublicViewTK stk+        utc = posixSecondsToUTCTime (realToFrac pt)+        pkp = keyPktPKPayload kp+        flags = effectiveKeyFlagsAt utc publicView+        ska = secretKeyPktSKAddendum kp+    guard (null (_tkRevs publicView))+    guard (isTKTimeValid utc publicView)+    guard (flagsAllowCertification flags)+    guard (canCertifyWith ska)+    guard (rsaKeySizeAcceptable pkp)+    pure kp +flagsAllowCertification :: Maybe (S.Set KeyFlag) -> Bool+flagsAllowCertification Nothing = True+flagsAllowCertification (Just keyFlags) =+    S.null keyFlags || S.member CertifyKeysKey keyFlags++canCertifyWith :: SKAddendum -> Bool+canCertifyWith ska =+    case ska of+        SUSUnprotected (RSAPrivateKey (RSA_PrivateKey _)) _ -> True+        SUSUnprotected (EdDSAPrivateKey _ _) _ -> True+        SUSUnprotected (Ed25519PrivateKey _) _ -> True+        SUSUnprotected (Ed448PrivateKey _) _ -> True+        _ -> False+ addUserIdCertifications-    :: SomeTK -> [Text] -> Bool -> [TK 'SecretTK] -> IO SomeTK-addUserIdCertifications targetTk targetUserIds requireSelfSig signerTks = do+    :: SomeTK+    -> [Text]+    -> Bool+    -> [(FilePath, KeyPkt 'SecretPkt)]+    -> IO SomeTK+addUserIdCertifications targetTk targetUserIds requireSelfSig certSigners = do     forM_ targetUserIds $ \targetUserId ->         case find             ((== targetUserId) . fst)@@ -2276,35 +2486,18 @@     newSigs <-         concat             <$> forM-                signerTks-                ( \signerTk ->+                certSigners+                ( \(_path, signerKp) ->                     forM                         targetUserIds                         ( \targetUserId -> do-                            let signerPkp =-                                    keyPktPKPayload-                                        ( _tkPrimaryKey-                                            ( someTKToPublicViewTK-                                                (SomeSecretTK signerTk)-                                            )-                                        )+                            let signerPkp = keyPktPKPayload signerKp                                 isSelf =                                     certificatePrimaryFingerprint targetTk-                                        == certificatePrimaryFingerprint-                                            (SomeSecretTK signerTk)+                                        == unFingerprint (fingerprint signerPkp)                                 certType =                                     if isSelf then PositiveCert else GenericCert-                                signerKp =-                                    _tkPrimaryKey signerTk-                                ska =-                                    ( case signerKp of-                                        KeyPktSecretPrimary _ ska -> ska-                                        _ -> error "certify-userid: unexpected primary key type"-                                    )-                            unless (hasSecretKeyMaterial (SomeSecretTK signerTk)) $-                                failWith-                                    KeyCannotCertify-                                    "certify-userid: signer certificate has no secret key material"+                                ska = secretKeyPktSKAddendum signerKp                             issuer <- issuerSubpacketsFor "certify-userid" signerPkp                             let hashed =                                     [ SigSubPacket@@ -2379,7 +2572,7 @@                                                 sk                                 _ ->                                     failWith-                                        BadData+                                        KeyCannotCertify                                         "certify-userid: unsupported secret key type"                             case result of                                 Left err ->@@ -2396,6 +2589,7 @@     pure $ case targetTk of         SomePublicTK tk -> SomePublicTK tk {_tkUIDs = map updateUID (_tkUIDs tk)}         SomeSecretTK tk -> SomeSecretTK tk {_tkUIDs = map updateUID (_tkUIDs tk)}+        SomeMixedTK tk -> SomeMixedTK tk {_tkUIDs = map updateUID (_tkUIDs tk)}  doRevokeKey :: POSIXTime -> RevokeKeyOptions -> IO () doRevokeKey _cpt RevokeKeyOptions {..} = do@@ -2408,76 +2602,71 @@             map                 Passphrase                 (concatMap (passwordRetryCandidates . BL.toStrict) keyPasswordsRaw)-    input <- runConduitRes $ CB.sourceHandle stdin .| CC.sinkLazy-    keyPkts <- decodeOpenPGPInput "standard input" input-    keyTks <--        runConduitRes $-            CL.sourceList keyPkts-                .| conduitToSomeTKsDroppingEither-                .| conduitDropErrorsAndNothings-                .| CC.sinkList+    keyTks <- loadKEYSFromStdin "revoke-key"     when (null keyTks) $         failWith-            MissingInput+            BadData             "revoke-key: no key found on standard input"-    when (any (not . hasSecretKeyMaterial) keyTks) $-        failWith-            MissingInput-            "revoke-key: expected transferable secret key input on standard input"-    let secretKeyTks = onlySecretTKs keyTks-    revocationSigPkts <--        forM secretKeyTks $ \secretTk -> do+    forM_ keyTks $ \tk ->+        unless (someTKHasSecretMaterial tk) $+            failWith+                BadData+                ( "revoke-key: standard input contains certificate "+                    ++ describeKey tk+                    ++ " without secret key material; KEYS must be a transferable secret key"+                )+    revocations <-+        forM keyTks $ \tk -> do             unlocked <--                unlockTransferableSecretKeyMaterial+                unlockSomeTransferableSecretKeyMaterial                     "revoke-key failed"                     "standard input"                     "--with-key-password"                     keyPasswords-                    secretTk-            let kp = _tkPrimaryKey unlocked+                    tk+            kp <-+                case someTKPrimarySecretKeyPkt unlocked of+                    Just kp -> pure kp+                    Nothing ->+                        failWith+                            BadData+                            ( "revoke-key: key "+                                ++ describeKey unlocked+                                ++ " has no secret primary key material"+                            )             issuer <- issuerSubpacketsFor "revoke-key" (keyPktPKPayload kp)             let hashed =                     [ SigSubPacket                         False                         (SigCreationTime (_timestamp (keyPktPKPayload kp)))                     ]-            result <- case kp of-                KeyPktSecretPrimary-                    _-                    (SUSUnprotected (RSAPrivateKey (RSA_PrivateKey k)) _) ->-                        signDirectKey-                            SHA512-                            KeyRevocationSig-                            kp-                            hashed-                            issuer-                            (k {RSA.private_p = 0, RSA.private_q = 0})-                KeyPktSecretPrimary-                    _-                    (SUSUnprotected (EdDSAPrivateKey EdSigningCurve25519 rawBytes) _) ->-                        case eitherCryptoError (Ed25519.secretKey rawBytes) of-                            Left err ->-                                failWith BadData ("revoke-key: bad Ed25519 key: " ++ show err)-                            Right sk -> signDirectKey SHA512 KeyRevocationSig kp hashed issuer sk-                KeyPktSecretPrimary-                    _-                    (SUSUnprotected (Ed25519PrivateKey rawBytes) _) ->-                        case eitherCryptoError (Ed25519.secretKey rawBytes) of-                            Left err ->-                                failWith BadData ("revoke-key: bad Ed25519 key: " ++ show err)-                            Right sk -> signDirectKey SHA512 KeyRevocationSig kp hashed issuer sk-                KeyPktSecretPrimary-                    _-                    (SUSUnprotected (EdDSAPrivateKey EdSigningCurve448 rawBytes) _) ->-                        case eitherCryptoError (Ed448.secretKey rawBytes) of-                            Left err -> failWith BadData ("revoke-key: bad Ed448 key: " ++ show err)-                            Right sk -> signDirectKey SHA512 KeyRevocationSig kp hashed issuer sk-                KeyPktSecretPrimary-                    _-                    (SUSUnprotected (Ed448PrivateKey rawBytes) _) ->-                        case eitherCryptoError (Ed448.secretKey rawBytes) of-                            Left err -> failWith BadData ("revoke-key: bad Ed448 key: " ++ show err)-                            Right sk -> signDirectKey SHA512 KeyRevocationSig kp hashed issuer sk+            result <- case secretKeyPktSKAddendum kp of+                (SUSUnprotected (RSAPrivateKey (RSA_PrivateKey k)) _) ->+                    signDirectKey+                        SHA512+                        KeyRevocationSig+                        kp+                        hashed+                        issuer+                        (k {RSA.private_p = 0, RSA.private_q = 0})+                (SUSUnprotected (EdDSAPrivateKey EdSigningCurve25519 rawBytes) _) ->+                    case eitherCryptoError (Ed25519.secretKey rawBytes) of+                        Left err ->+                            failWith BadData ("revoke-key: bad Ed25519 key: " ++ show err)+                        Right sk -> signDirectKey SHA512 KeyRevocationSig kp hashed issuer sk+                (SUSUnprotected (Ed25519PrivateKey rawBytes) _) ->+                    case eitherCryptoError (Ed25519.secretKey rawBytes) of+                        Left err ->+                            failWith BadData ("revoke-key: bad Ed25519 key: " ++ show err)+                        Right sk -> signDirectKey SHA512 KeyRevocationSig kp hashed issuer sk+                (SUSUnprotected (EdDSAPrivateKey EdSigningCurve448 rawBytes) _) ->+                    case eitherCryptoError (Ed448.secretKey rawBytes) of+                        Left err -> failWith BadData ("revoke-key: bad Ed448 key: " ++ show err)+                        Right sk -> signDirectKey SHA512 KeyRevocationSig kp hashed issuer sk+                (SUSUnprotected (Ed448PrivateKey rawBytes) _) ->+                    case eitherCryptoError (Ed448.secretKey rawBytes) of+                        Left err -> failWith BadData ("revoke-key: bad Ed448 key: " ++ show err)+                        Right sk -> signDirectKey SHA512 KeyRevocationSig kp hashed issuer sk                 _ ->                     failWith                         BadData@@ -2487,15 +2676,12 @@                     failWith                         BadData                         ("revoke-key: failed: " ++ show err)-                Right sig -> pure sig+                Right sig -> pure (unlocked, sig)     let mergedCerts =-            zipWith-                ( \sk sig ->-                    let pubTk = someTKToPublicViewTK (SomeSecretTK sk)-                     in SomePublicTK pubTk {_tkRevs = _tkRevs pubTk ++ [sig]}-                )-                secretKeyTks-                revocationSigPkts+            [ let pubTk = someTKToPublicViewTK tk+               in SomePublicTK pubTk {_tkRevs = _tkRevs pubTk ++ [sig]}+            | (tk, sig) <- revocations+            ]         output = runPut (mapM_ Bin.put mergedCerts)     BL.putStr $         if revokeKeyNoArmor@@ -2533,19 +2719,27 @@             map                 Passphrase                 (concatMap (passwordRetryCandidates . BL.toStrict) keyPasswordsRaw)-    stdinInput <--        runConduitRes $ CB.sourceHandle stdin .| CC.sinkLazy-    stdinPkts <- decodeOpenPGPInput "stdin" stdinInput-    stdinTks <--        runConduitRes $-            CL.sourceList stdinPkts-                .| conduitToSomeTKsDroppingEither-                .| conduitDropErrorsAndNothings-                .| CL.mapMaybe someTKToSecretTK-                .| CC.sinkList+    stdinLoadedTks <- loadKEYSFromStdin "update-key"+    when (null stdinLoadedTks) $+        failWith+            BadData+            "update-key: no key found on standard input"+    forM_ stdinLoadedTks $ \tk ->+        unless (someTKHasSecretMaterial tk) $+            failWith+                BadData+                ( "update-key: standard input contains certificate "+                    ++ describeKey tk+                    ++ " without secret key material; KEYS must be a transferable secret key"+                )+    let stdinTks = mapMaybe someTKToSecretTK stdinLoadedTks+    when (length stdinTks /= length stdinLoadedTks) $+        failWith+            BadData+            "update-key: mixed public/secret transferable keys are not supported"     when (null stdinTks) $         failWith-            MissingInput+            BadData             "update-key: no key found on standard input"     updateSourceTks <-         concat@@ -2612,7 +2806,7 @@                 PrimaryKeyBad                 "update-key: output key has no decryption capability"     let armorType =-            if any hasSecretKeyMaterial modernizedTks+            if any someTKHasSecretMaterial modernizedTks                 then ArmorPrivateKeyBlock                 else ArmorPublicKeyBlock         output = runPut (mapM_ Bin.put modernizedTks)@@ -2828,25 +3022,22 @@                     (passwordRetryCandidates . BL.toStrict)                     signingPasswordsRaw                 )-    ks <- loadSigningKeys "sign" sKeyFiles signingPasswords+    loadedKeys <- loadSigningKeys "sign" sKeyFiles signingPasswords     let ts = ThirtyTwoBitTimeStamp (floor pt)         payload' = BL.fromChunks mbs         payload = payload'-    processedKeys <- mapM (normalizeSigningKey pt) ks-    let perTransferKeySigners = map (signingCapableRSAFunKeys pt . SomeSecretTK) processedKeys-        signingHash =+    keys <- mapM (normalizeSomeKeyMaterial "sign" pt) loadedKeys+    perTransferKeySigners <-+        requireSigningFunKeysAt "sign" pt (const True) keys+    let signingHash =             selectSigningHash-                (concat perTransferKeySigners)+                perTransferKeySigners                 []                 legacySigningHashFallbackOrder-    when (any null perTransferKeySigners) $-        failWith-            KeyCannotSign-            "sign: supplied key cannot produce detached signatures"     signatures <-         mapM             (signData sAs ts signingHash payload)-            (concat perTransferKeySigners)+            perTransferKeySigners     let output = runPut (mapM_ (Bin.put . SignaturePkt) signatures)     case sMicalgOut of         Just outPath ->@@ -2893,38 +3084,50 @@         ]     unhashed pkp = issuerSubpacketsFor "sign" pkp loadSigningKeys-    :: String -> [String] -> [Passphrase] -> IO [TK 'SecretTK]-loadSigningKeys context keyFiles keyPasswords = concat <$> mapM loadSigningKeyFile keyFiles+    :: String -> [String] -> [Passphrase] -> IO [(FilePath, SomeTK)]+loadSigningKeys context keyFiles keyPasswords =+    concat <$> mapM loadSigningKeyFile keyFiles   where     loadSigningKeyFile path = do-        packets <- loadOpenPGPPackets context path-        tks <--            runConduitRes $-                CL.sourceList packets-                    .| conduitToSomeTKsDroppingEither-                    .| conduitDropErrorsAndNothings-                    .| CC.sinkList-        let fallbackTks = signingFallbackTKs packets-        when (null tks && null fallbackTks) $+        tks <- loadKEYSFromFile context path+        when (null tks) $             failWith-                MissingInput-                ("sign: no secret key material found in " ++ path)-        let secretTks =-                if null tks-                    then map secretTKFromSome fallbackTks-                    else onlySecretTKs tks-        mapM-            (decryptSigningKeyMaterial path keyPasswords)-            secretTks+                BadData+                (context ++ ": no OpenPGP key material found in " ++ path)+        mapM (prepare path) tks+    prepare path tk = do+        unless (someTKHasSecretMaterial tk) $+            failWith+                BadData+                ( context+                    ++ ": "+                    ++ path+                    ++ " contains certificate "+                    ++ describeKey tk+                    ++ " without secret key material; KEYS must be a transferable secret key"+                )+        unlocked <-+            unlockSomeTransferableSecretKeyMaterial+                (context ++ " failed")+                path+                "--with-key-password"+                keyPasswords+                tk+        pure (path, unlocked) -decryptSigningKeyMaterial-    :: FilePath -> [Passphrase] -> TK 'SecretTK -> IO (TK 'SecretTK)-decryptSigningKeyMaterial path keyPasswords tk =-    unlockTransferableSecretKeyMaterial-        "sign failed"-        path-        "--with-key-password"-        keyPasswords+describeKey :: SomeTK -> String+describeKey = hexEncodeBytes . certificatePrimaryFingerprint++unlockSomeTransferableSecretKeyMaterial+    :: String+    -> FilePath+    -> String+    -> [Passphrase]+    -> SomeTK+    -> IO SomeTK+unlockSomeTransferableSecretKeyMaterial context path passwordOption keyPasswords tk =+    modifySomeTKSecretKeysM+        (unlockSecretAddendum context path passwordOption keyPasswords)         tk  unlockTransferableSecretKeyMaterial@@ -2978,42 +3181,90 @@             Left _ -> tryDecrypt rest             Right (_, decrypted) -> Right decrypted -normalizeSigningKey-    :: POSIXTime -> TK 'SecretTK -> IO (TK 'SecretTK)-normalizeSigningKey pt tk =-    case processTK (Just pt) (SomeSecretTK tk) of-        Left err ->+normalizeSomeKeyMaterial+    :: String+    -> POSIXTime+    -> (FilePath, SomeTK)+    -> IO (FilePath, SomeTK)+normalizeSomeKeyMaterial context pt (path, stk) =+    case processTK (Just pt) stk of+        Left err+            -- A revoked key is structurally valid but signature-incapable;+            -- let the capability checks report the appropriate error code+            -- instead of turning it into a parse/data error.+            | keyLooksRevoked stk -> pure (path, stk)+            | otherwise ->+                failWith+                    BadData+                    ( context+                        ++ ": invalid key material in "+                        ++ path+                        ++ ": "+                        ++ err+                    )+        Right normalized+            | someTKHasSecretMaterial normalized -> pure (path, normalized)+            | otherwise ->+                failWith+                    BadData+                    ( context+                        ++ ": "+                        ++ path+                        ++ " contains certificate "+                        ++ describeKey normalized+                        ++ " without secret key material"+                    )++keyLooksRevoked :: SomeTK -> Bool+keyLooksRevoked stk =+    not (null (_tkRevs publicView))+        || any (any isSubkeyRevocation . snd) (_tkSubs publicView)+  where+    publicView = someTKToPublicViewTK stk++requireSigningFunKeysAt+    :: String+    -> POSIXTime+    -> (FunKey -> Bool)+    -> [(FilePath, SomeTK)]+    -> IO [FunKey]+requireSigningFunKeysAt context pt keep keyTks = do+    perKey <- forM keyTks $ \(path, stk) -> do+        let fs = filter keep (usableSigningFunKeysAt pt stk)+        when (null fs) $             failWith-                BadData-                ("sign: invalid signing key material: " ++ show err)-        Right normalized ->-            case normalized of-                SomeSecretTK tk' -> pure tk'-                SomePublicTK {} -> error "normalizeSigningKey: expected secret key"+                KeyCannotSign+                ( context+                    ++ ": key "+                    ++ describeKey stk+                    ++ " in "+                    ++ path+                    ++ " cannot produce a signature"+                )+        pure fs+    pure (concat perKey)  signPayloadWithKeys     :: POSIXTime     -> AsBinaryText     -> BL.ByteString-    -> [TK 'SecretTK]+    -> [(FilePath, SomeTK)]     -> [HashAlgorithm]     -> [HashAlgorithm]     -> IO [SignaturePayload] signPayloadWithKeys pt asMode payload keys recipientHashPrefs fallbackOrder = do-    processedKeys <- mapM (normalizeSigningKey pt) keys-    let perTransferKeySigners = map (signingCapableRSAFunKeys pt . SomeSecretTK) processedKeys-        signingHash =+    processedKeys <-+        mapM (normalizeSomeKeyMaterial "encrypt" pt) keys+    perTransferKeySigners <-+        requireSigningFunKeysAt "encrypt" pt (const True) processedKeys+    let signingHash =             selectSigningHash-                (concat perTransferKeySigners)+                perTransferKeySigners                 recipientHashPrefs                 fallbackOrder-    when (any null perTransferKeySigners) $-        failWith-            KeyCannotSign-            "encrypt: supplied key cannot produce signatures"     mapM         (signData asMode ts signingHash payload)-        (concat perTransferKeySigners)+        perTransferKeySigners   where     ts = ThirtyTwoBitTimeStamp (floor pt)     signData@@ -3049,29 +3300,84 @@         ]     unhashed pkp = issuerSubpacketsFor "encrypt" pkp -signingCapableFunKeys :: POSIXTime -> SomeTK -> [FunKey]-signingCapableFunKeys pt =-    filter canSign . tkToFunKeysAt pt+{- | Whether a signature-capable component may be used as a signing key+at the given time.  This accounts for expiry, revocation, usage flags,+and unsupported or too-small algorithms.+-}+usableSigningFunKeysAt :: POSIXTime -> SomeTK -> [FunKey]+usableSigningFunKeysAt pt stk =+    filter usable (tkToFunKeysAt pt stk)   where-    canSign k =-        canSignDataUsage (fkufs k)-            && case fmska k of-                Just (SUSUnprotected (RSAPrivateKey (RSA_PrivateKey _)) _) -> True-                Just (SUSUnprotected (ECDSAPrivateKey (ECDSA_PrivateKey _)) _) -> True-                Just (SUSUnprotected (EdDSAPrivateKey _ _) _) -> True-                Just (SUSUnprotected (Ed25519PrivateKey _) _) -> True-                Just (SUSUnprotected (Ed448PrivateKey _) _) -> True-                Just (SUSUnprotected (UnknownSKey _) _) ->-                    isEd25519PKA (_pkalgo (fpkp k))-                        || isEdDSAPKA (_pkalgo (fpkp k))-                        || isEd448PKA (_pkalgo (fpkp k))-                _ -> False-    canSignDataUsage keyFlags = S.null keyFlags || S.member SignDataKey keyFlags+    utc = posixSecondsToUTCTime (realToFrac pt)+    publicView = someTKToPublicViewTK stk+    primaryPkp = keyPktPKPayload (_tkPrimaryKey publicView)+    primaryFp = fingerprint primaryPkp+    primaryRevoked = not (null (_tkRevs publicView))+    primaryValid =+        not primaryRevoked && isTKTimeValid utc publicView+    primaryFlags = effectiveKeyFlagsAt utc publicView+    subkeyBindings =+        [ (fingerprint (keyPktPKPayload kp), keyPktPKPayload kp, sigs)+        | (kp, sigs) <- _tkSubs publicView+        ]+    usable k+        | fingerprint (fpkp k) == primaryFp =+            primaryValid+                && componentAllowsSigning (fkufs k) primaryFlags+                && canSignAlgorithm k+                && rsaKeySizeAcceptable (fpkp k)+        | otherwise =+            case find+                (\(fp, _, _) -> fp == fingerprint (fpkp k))+                subkeyBindings of+                Nothing -> False+                Just (fp, skPkp, sigs) ->+                    primaryValid+                        && not (any isSubkeyRevocation sigs)+                        && isPKTimeValidWithSelfSignatures+                            utc+                            skPkp+                            (filter isSKBindingSig sigs)+                        && componentAllowsSigning+                            (fkufs k)+                            (effectiveSubkeyFlagsAt utc publicView fp)+                        && canSignAlgorithm k+                        && rsaKeySizeAcceptable (fpkp k) --- Legacy alias kept for internal call sites that have not been updated.-signingCapableRSAFunKeys :: POSIXTime -> SomeTK -> [FunKey]-signingCapableRSAFunKeys = signingCapableFunKeys+canSignAlgorithm :: FunKey -> Bool+canSignAlgorithm k =+    case fmska k of+        Just (SUSUnprotected (RSAPrivateKey (RSA_PrivateKey _)) _) -> True+        Just (SUSUnprotected (ECDSAPrivateKey (ECDSA_PrivateKey _)) _) -> True+        Just (SUSUnprotected (EdDSAPrivateKey _ _) _) -> True+        Just (SUSUnprotected (Ed25519PrivateKey _) _) -> True+        Just (SUSUnprotected (Ed448PrivateKey _) _) -> True+        Just (SUSUnprotected (UnknownSKey _) _) ->+            isEd25519PKA (_pkalgo (fpkp k))+                || isEdDSAPKA (_pkalgo (fpkp k))+                || isEd448PKA (_pkalgo (fpkp k))+        _ -> False +componentAllowsSigning+    :: S.Set KeyFlag -> Maybe (S.Set KeyFlag) -> Bool+componentAllowsSigning sigFlags effectiveFlags =+    flagsAllowSigning (Just sigFlags)+        && flagsAllowSigning effectiveFlags++flagsAllowSigning :: Maybe (S.Set KeyFlag) -> Bool+flagsAllowSigning Nothing = True+flagsAllowSigning (Just keyFlags) =+    S.null keyFlags || S.member SignDataKey keyFlags++rsaKeySizeAcceptable :: SomePKPayload -> Bool+rsaKeySizeAcceptable pkp =+    case _pubkey pkp of+        RSAPubKey _ ->+            case pubkeySize (_pubkey pkp) of+                Right bits -> bits >= 2048+                Left _ -> False+        _ -> True+ {- | Algorithm-dispatching signature helper used by all sign paths. Supports RSA (v4), Ed25519 (v4), and Ed448 (v4). -}@@ -4515,11 +4821,7 @@  tkToFunKeysAt :: POSIXTime -> SomeTK -> [FunKey] tkToFunKeysAt pt stk =-    catMaybes-        ( mainKey : case stk of-            SomePublicTK _ -> map extractPublic (_tkSubs publicView)-            SomeSecretTK secretTk -> map extractSecret (_tkSubs secretTk)-        )+    catMaybes (mainKey : subKeys)   where     publicView = someTKToPublicViewTK stk     pkp = keyPktPKPayload (_tkPrimaryKey publicView)@@ -4527,6 +4829,8 @@         SomeSecretTK secretTk -> case _tkPrimaryKey secretTk of             KeyPktSecretPrimary _ ska -> Just ska             _ -> Nothing+        SomeMixedTK mixedTk ->+            someKeyPktMaybeSKAddendum (_tkPrimaryKey mixedTk)         SomePublicTK _ -> Nothing     uids = _tkUIDs publicView     mainPreferredHashes = effectiveHashPreferencesAt pt stk@@ -4542,6 +4846,16 @@                 mainPreferredSymmetricAlgorithms                 mainSupportsSEIPDv2             )+    subKeys = case stk of+        SomePublicTK tk ->+            map+                (\(kp, sigs) -> extractSub (SomeKeyPkt kp) sigs)+                (_tkSubs tk)+        SomeSecretTK tk ->+            map+                (\(kp, sigs) -> extractSub (SomeKeyPkt kp) sigs)+                (_tkSubs tk)+        SomeMixedTK tk -> map (uncurry extractSub) (_tkSubs tk)     sig2KUFs = getHasheds >=> find isKUF >=> getKUFs     grabASig :: [(a, [b])] -> Maybe b     grabASig = (listToMaybe >=> listToMaybe) . map snd -- FIXME: this should grab the "best" sig@@ -4552,8 +4866,8 @@     getKUFs :: SigSubPacket -> Maybe (S.Set KeyFlag)     getKUFs (SigSubPacket _ (KeyFlags kfs)) = Just kfs     getKUFs _ = Nothing-    extractPublic :: (KeyPkt k, [SignaturePayload]) -> Maybe FunKey-    extractPublic (KeyPktPublicSubkey spkp, sigs) =+    extractSub :: SomeKeyPkt -> [SignaturePayload] -> Maybe FunKey+    extractSub (SomeKeyPkt (KeyPktPublicSubkey spkp)) sigs =         return             ( FunKey                 spkp@@ -4563,9 +4877,7 @@                 mainPreferredSymmetricAlgorithms                 mainSupportsSEIPDv2             )-    extractPublic _ = Nothing-    extractSecret :: (KeyPkt k, [SignaturePayload]) -> Maybe FunKey-    extractSecret (KeyPktSecretSubkey spkp sska, sigs) =+    extractSub (SomeKeyPkt (KeyPktSecretSubkey spkp sska)) sigs =         return             ( FunKey                 spkp@@ -4575,7 +4887,7 @@                 mainPreferredSymmetricAlgorithms                 mainSupportsSEIPDv2             )-    extractSecret _ = Nothing+    extractSub _ _ = Nothing  effectiveHashPreferencesAt     :: POSIXTime -> SomeTK -> [HashAlgorithm]@@ -6148,7 +6460,9 @@     signerFp = hexEncodeBytes (unFingerprint signer)     modeLabel = signatureModeField sig     certFp =-        case find (\tk -> keyMatchesFingerprint True tk signer) (concatMap snd certTkPairs) of+        case find+            (\tk -> keyMatchesFingerprint True tk signer)+            (concatMap snd certTkPairs) of             Just tk ->                 hexEncodeBytes                     ( ( unFingerprint@@ -6163,12 +6477,13 @@         | (certName, tks) <- certTkPairs         , any (\tk -> keyMatchesFingerprint True tk signer) tks         ]-    jsonTrailer = BLC8.unpack-        ( A.encode-            ( A.object-                [ AK.fromString "signers" A..= signerNames ]+    jsonTrailer =+        BLC8.unpack+            ( A.encode+                ( A.object+                    [AK.fromString "signers" A..= signerNames]+                )             )-        )  signatureModeField :: SignaturePayload -> String signatureModeField sig =@@ -7263,21 +7578,22 @@                     (passwordRetryCandidates . BL.toStrict)                     signingPasswordsRaw                 )-    ks <-+    loadedKeys <-         loadSigningKeys "inline-sign" inlineSignKeyFiles signingPasswords-    processedKeys <- mapM (normalizeSigningKey pt) ks+    keys <-+        mapM (normalizeSomeKeyMaterial "inline-sign" pt) loadedKeys     let ts = ThirtyTwoBitTimeStamp (floor pt)         payloadRaw = BL.fromChunks mbs-        funkeys = concatMap (tkToFunKeysAt pt . SomeSecretTK) processedKeys-        signingKeys = filter isInlineRSASigner funkeys-        inlineSignHash =-            selectSigningHash signingKeys [] legacySigningHashFallbackOrder-    when (null processedKeys) $+    when (null keys) $         failWith MissingInput "inline-sign: no signing key found"-    when (null signingKeys) $-        failWith-            KeyCannotSign-            "inline-sign: supplied key is not capable of signing"+    signingKeys <-+        requireSigningFunKeysAt+            "inline-sign"+            pt+            isInlineSigningCapable+            keys+    let inlineSignHash =+            selectSigningHash signingKeys [] legacySigningHashFallbackOrder     sigs <-         mapM             ( signInlineData@@ -7352,10 +7668,6 @@                     || isEdDSAPKA (_pkalgo (fpkp k))                     || isEd448PKA (_pkalgo (fpkp k))             _ -> False---- Legacy alias.-isInlineRSASigner :: FunKey -> Bool-isInlineRSASigner = isInlineSigningCapable  signInlineData     :: ThirtyTwoBitTimeStamp
hopenpgp-tools.cabal view
@@ -1,6 +1,6 @@ cabal-version:       3.0 name:                hopenpgp-tools-version:             0.26.1+version:             0.26.2 synopsis:            hOpenPGP-based command-line tools description:         command-line tools for performing some OpenPGP-related operations homepage:            https://salsa.debian.org/clint/hOpenPGP-tools@@ -25,7 +25,7 @@                ,       bytestring                ,       conduit                >= 1.3                ,       errors-               ,       hOpenPGP               >= 3.7        && < 3.8+               ,       hOpenPGP               >= 3.7.3      && < 3.8                ,       lens                ,       optparse-applicative   >= 0.18.1                ,       prettyprinter          >= 1.7@@ -132,4 +132,4 @@ source-repository this   type:     git   location: https://salsa.debian.org/clint/hopenpgp-tools.git-  tag:      hopenpgp-tools/0.26+  tag:      hopenpgp-tools/0.26.2