diff options
-rw-r--r-- | kiki.hs | 69 |
1 files changed, 68 insertions, 1 deletions
@@ -1537,6 +1537,71 @@ signature_time ov = case if null cs then ds else cs of | |||
1537 | creationTime (SignatureCreationTimePacket t) = [t] | 1537 | creationTime (SignatureCreationTimePacket t) = [t] |
1538 | creationTime _ = [] | 1538 | creationTime _ = [] |
1539 | 1539 | ||
1540 | kiki_usage = do | ||
1541 | putStr . unlines $ | ||
1542 | ["kiki - a pgp key editing utility" | ||
1543 | ,"" | ||
1544 | ,"kiki [OPTIONS]" | ||
1545 | ,"" | ||
1546 | ," kiki merges a set of keyring files into a combined database and then" | ||
1547 | ," uses the database to update the files so that they have the most complete" | ||
1548 | ," information." | ||
1549 | ,"" | ||
1550 | ," The files pubring.gpg and subring.gpg in the directory specified by the " | ||
1551 | ," --homedir option are implicitly included in the keyring set." | ||
1552 | ,"" | ||
1553 | ," kiki can also import or export secret subkeys by using the --keypairs option." | ||
1554 | ,"" | ||
1555 | ," Subkeys that are imported with kiki are given an annotation \"usage@\" which" | ||
1556 | ," indicates what the key is for. This tag can be used as a SPEC to select a" | ||
1557 | ," particular key. Master keys may be specified by using fingerprints or by" | ||
1558 | ," specifying a substring of an associated UID." | ||
1559 | ,"" | ||
1560 | ,"Flags:" | ||
1561 | ," --homedir DIR" | ||
1562 | ," Where to find the the files secring.gpg and pubring.gpg. The " | ||
1563 | ," default location is taken from the environment variable " | ||
1564 | ," GNUPGHOME." | ||
1565 | ,"" | ||
1566 | ," --passphrase-fd N" | ||
1567 | ," Read passphrase from the given file descriptor." | ||
1568 | ,"" | ||
1569 | ," --import Add master keys to pubring.gpg. Without this option, only UID" | ||
1570 | ," and subkey data is updated. " | ||
1571 | ,"" | ||
1572 | ," --autosign Sign all cross-certified tor-style UIDs." | ||
1573 | ," A tor-style UID is of the form:" | ||
1574 | ," Anonymous <root@HOSTNAME.onion>" | ||
1575 | ," It is considered cross certified if there exists a cross-certified" | ||
1576 | ," 'tor' subkey corresponding to the address HOSTNAME.onion." | ||
1577 | ,"" | ||
1578 | ,"Merging:" | ||
1579 | ," --keyrings FILE FILE..." | ||
1580 | ," Provide keyring files other than the implicit secring.gpg and" | ||
1581 | ," pubring.gpg in the --homedir. This option is implicit unless" | ||
1582 | ," --keypairs is used." | ||
1583 | ,"" | ||
1584 | ," --keypairs KEYSPEC KEYSPEC..." | ||
1585 | ," Each KEYSPEC specifies that a key should match the content and" | ||
1586 | ," timestamp of an external PKCS #1 private RSA key file." | ||
1587 | ," " | ||
1588 | ," KEYSPEC ::= SPEC=FILE{CMD} " | ||
1589 | ,"" | ||
1590 | ," If neither SPEC or FILE match any keys, then the CMD will be " | ||
1591 | ," executed in order to create the FILE." | ||
1592 | ,"" | ||
1593 | ,"Output:" | ||
1594 | ," --show-wk Show fingerprints for the working key (which will be used to" | ||
1595 | ," make signatures) and all its subkeys and UID." | ||
1596 | ,"" | ||
1597 | ," --show-all Show fingerprints and UIDs and usage tags for all known keys." | ||
1598 | ,"" | ||
1599 | ," --show-pem SPEC" | ||
1600 | ," Outputs the PKCS #8 public key corresponding to SPEC." | ||
1601 | ,"" | ||
1602 | ," --help Shows this help screen." | ||
1603 | ] | ||
1604 | |||
1540 | main = do | 1605 | main = do |
1541 | dotlock_init | 1606 | dotlock_init |
1542 | {- | 1607 | {- |
@@ -1568,6 +1633,7 @@ main = do | |||
1568 | , ("--show-wk",0) | 1633 | , ("--show-wk",0) |
1569 | , ("--show-all",0) | 1634 | , ("--show-all",0) |
1570 | , ("--show-pem",1) | 1635 | , ("--show-pem",1) |
1636 | , ("--help",0) | ||
1571 | ] | 1637 | ] |
1572 | args | 1638 | args |
1573 | args' = if map (take 1) (take 1 vargs) == ["-"] | 1639 | args' = if map (take 1) (take 1 vargs) == ["-"] |
@@ -1703,7 +1769,8 @@ main = do | |||
1703 | -- On last pass, interpret --show-* commands. | 1769 | -- On last pass, interpret --show-* commands. |
1704 | let shspec = Map.fromList [("--show-wk", const $ show_wk secfile grip) | 1770 | let shspec = Map.fromList [("--show-wk", const $ show_wk secfile grip) |
1705 | ,("--show-all",const $ show_all) | 1771 | ,("--show-all",const $ show_all) |
1706 | ,("--show-pem",\[x] -> show_pem x $ maybe "" id grip) ] | 1772 | ,("--show-pem",\[x] -> show_pem x $ maybe "" id grip) |
1773 | ,("--help", \_ _ ->kiki_usage)] | ||
1707 | shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs | 1774 | shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs |
1708 | 1775 | ||
1709 | forM_ shargs $ \(cmd,args) -> cmd args use_db | 1776 | forM_ shargs $ \(cmd,args) -> cmd args use_db |