| 1 |
package certificate |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/smallstep/cli/command" |
| 5 |
"github.com/urfave/cli" |
| 6 |
) |
| 7 |
|
| 8 |
|
| 9 |
func init() { |
| 10 |
cmd := cli.Command{ |
| 11 |
Name: "certificate", |
| 12 |
Usage: "create, revoke, validate, bundle, and otherwise manage certificates", |
| 13 |
UsageText: "step certificate SUBCOMMAND [ARGUMENTS] [GLOBAL_FLAGS] [SUBCOMMAND_FLAGS]", |
| 14 |
Description: `**step certificate** command group provides facilities for creating |
| 15 |
certificate signing requests (CSRs), creating self-signed certificates |
| 16 |
(e.g., for use as a root certificate authority), generating leaf or |
| 17 |
intermediate CA certificate by signing a CSR, validating certificates, |
| 18 |
renewing certificates, generating certificate bundles, and key-wrapping |
| 19 |
of private keys. |
| 20 |
|
| 21 |
## EXAMPLES |
| 22 |
|
| 23 |
Create a root certificate and private key using the default parameters (EC P-256 curve): |
| 24 |
''' |
| 25 |
$ step certificate create foo foo.crt foo.key --profile root-ca |
| 26 |
''' |
| 27 |
|
| 28 |
Create a leaf certificate and private key using the default parameters (EC P-256 curve): |
| 29 |
''' |
| 30 |
$ step certificate create baz baz.crt baz.key --ca ./foo.crt --ca-key ./foo.key |
| 31 |
''' |
| 32 |
|
| 33 |
Create a CSR and private key using the default parameters (EC P-256 curve): |
| 34 |
''' |
| 35 |
$ step certificate create zap zap.csr zap.key --csr |
| 36 |
''' |
| 37 |
|
| 38 |
Sign a CSR and generate a signed certificate: |
| 39 |
''' |
| 40 |
$ step certificate sign zap.csr foo.crt foo.key |
| 41 |
''' |
| 42 |
|
| 43 |
Inspect the contents of a certificate: |
| 44 |
''' |
| 45 |
$ step certificate inspect ./baz.crt |
| 46 |
''' |
| 47 |
|
| 48 |
Verify the signature of a certificate: |
| 49 |
''' |
| 50 |
$ step certificate verify ./baz.crt --roots ./foo.crt |
| 51 |
''' |
| 52 |
|
| 53 |
Lint the contents of a certificate to check for common errors and missing fields: |
| 54 |
''' |
| 55 |
$ step certificate lint ./baz.crt |
| 56 |
''' |
| 57 |
|
| 58 |
Bundle an end certificate with the issuing certificate: |
| 59 |
''' |
| 60 |
$ step certificate bundle ./baz.crt ./foo.crt bundle.crt |
| 61 |
''' |
| 62 |
|
| 63 |
Convert PEM format certificate to DER and write to disk. |
| 64 |
''' |
| 65 |
$ step certificate format foo.pem --out foo.der |
| 66 |
''' |
| 67 |
|
| 68 |
Extract the public key from a PEM encoded certificate: |
| 69 |
''' |
| 70 |
$ step certificate key foo.crt |
| 71 |
''' |
| 72 |
|
| 73 |
Install a root certificate in the system truststore: |
| 74 |
''' |
| 75 |
$ step certificate install root-ca.crt |
| 76 |
''' |
| 77 |
|
| 78 |
Uninstall a root certificate from the system truststore: |
| 79 |
''' |
| 80 |
$ step certificate uninstall root-ca.crt |
| 81 |
'''`, |
| 82 |
|
| 83 |
Subcommands: cli.Commands{ |
| 84 |
bundleCommand(), |
| 85 |
createCommand(), |
| 86 |
formatCommand(), |
| 87 |
inspectCommand(), |
| 88 |
fingerprintCommand(), |
| 89 |
lintCommand(), |
| 90 |
signCommand(), |
| 91 |
verifyCommand(), |
| 92 |
keyCommand(), |
| 93 |
installCommand(), |
| 94 |
uninstallCommand(), |
| 95 |
p12Command(), |
| 96 |
}, |
| 97 |
} |
| 98 |
|
| 99 |
command.Register(cmd) |
| 100 |
} |