| 1 |
package main |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/flynn/go-docopt" |
| 5 |
"github.com/theupdateframework/go-tuf" |
| 6 |
) |
| 7 |
|
| 8 |
func init() { |
| 9 |
register("revoke-key", cmdRevokeKey, ` |
| 10 |
usage: tuf revoke-key [--expires=<days>] <role> <id> |
| 11 |
|
| 12 |
Revoke a signing key |
| 13 |
|
| 14 |
The key will be removed from the root metadata file, but the key will remain in the |
| 15 |
"keys" directory if present. |
| 16 |
|
| 17 |
Options: |
| 18 |
--expires=<days> Set the root metadata file to expire <days> days from now. |
| 19 |
`) |
| 20 |
} |
| 21 |
|
| 22 |
func cmdRevokeKey(args *docopt.Args, repo *tuf.Repo) error { |
| 23 |
if arg := args.String["--expires"]; arg != "" { |
| 24 |
expires, err := parseExpires(arg) |
| 25 |
if err != nil { |
| 26 |
return err |
| 27 |
} |
| 28 |
return repo.RevokeKeyWithExpires(args.String["<role>"], args.String["<id>"], expires) |
| 29 |
} |
| 30 |
return repo.RevokeKey(args.String["<role>"], args.String["<id>"]) |
| 31 |
} |