summaryrefslogtreecommitdiffstats
path: root/cmd/tuf/revoke_key.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/tuf/revoke_key.go')
-rw-r--r--cmd/tuf/revoke_key.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/cmd/tuf/revoke_key.go b/cmd/tuf/revoke_key.go
new file mode 100644
index 0000000..8aff2e0
--- /dev/null
+++ b/cmd/tuf/revoke_key.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "github.com/flynn/go-docopt"
+ "github.com/theupdateframework/go-tuf"
+)
+
+func init() {
+ register("revoke-key", cmdRevokeKey, `
+usage: tuf revoke-key [--expires=<days>] <role> <id>
+
+Revoke a signing key
+
+The key will be removed from the root metadata file, but the key will remain in the
+"keys" directory if present.
+
+Options:
+ --expires=<days> Set the root metadata file to expire <days> days from now.
+`)
+}
+
+func cmdRevokeKey(args *docopt.Args, repo *tuf.Repo) error {
+ if arg := args.String["--expires"]; arg != "" {
+ expires, err := parseExpires(arg)
+ if err != nil {
+ return err
+ }
+ return repo.RevokeKeyWithExpires(args.String["<role>"], args.String["<id>"], expires)
+ }
+ return repo.RevokeKey(args.String["<role>"], args.String["<id>"])
+}