Skip to content

Commit

Permalink
Rename option --from to --with
Browse files Browse the repository at this point in the history
  • Loading branch information
dvob committed Jun 21, 2020
1 parent 3e80315 commit 8623c2c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
pcert create myca --ca

# create server certificate
pcert create myapp.company.com --from myca \
pcert create myapp.company.com withfrom myca \
--server \
--dns api.myapp.company.com \
--dns localhost \
--ip 127.0.0.1 \
--ip 192.168.10.5

# create client certificate
pcert create myuser --client --from myca
pcert create myuser --client --with myca
```

## General
Expand All @@ -41,22 +41,22 @@ pcert create myca --ca
```

### Signed Certificates
To sign a new certificate with an existing certificate and key, you can use the options `--sign-cert <file>` and `--sign-key <file>`. For these two options there is also the shortform `--from <name>`, which uses the files `<name>.crt` and `<name>.key`.
To sign a new certificate with an existing certificate and key, you can use the options `--sign-cert <file>` and `--sign-key <file>`. For these two options there is also the shortform `--with <name>`, which uses the files `<name>.crt` and `<name>.key`.

Create a server certificate signed from `myca.crt` and `myca.key`:
```shell
pcert create api.test.local --server --from myca
pcert create api.test.local --server --with myca
```

Create a client certificate signed from `myca.crt` and `myca.key`:
```shell
pcert create myUser --client --from myca
pcert create myUser --client --with myca
```

### Subject Alternative Names (SANs)
To set subject alternative names on certificates you can use the options `--dns`, `--ip`, `--email` and `--uri`:
```shell
pcert create api.test.local --from myca --server \
pcert create api.test.local --with myca --server \
--dns api1.test.local \
--dns superapi.test.local \
--ip 127.0.0.1 \
Expand Down
2 changes: 1 addition & 1 deletion cmd/pcert/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func newCreateCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "create <name>",
Short: "Create a signed certificate and a key",
Long: `Creates a key and certificate. If --from or --sign-cert and --sign-key
Long: `Creates a key and certificate. If --with or --sign-cert and --sign-key
are specified the certificate is signed by these. Otherwise it will be self-signed.
The argument <name> is used as common name in the certificate if not overwritten
with the --subject option and as file name for the certificate (<name>.crt) and
Expand Down
2 changes: 1 addition & 1 deletion cmd/pcert/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type signPair struct {
func (s *signPair) bindFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&s.certFile, "sign-cert", "", "Certificate used to sign the certificate")
cmd.Flags().StringVar(&s.keyFile, "sign-key", "", "Key used to sign the certificates")
cmd.Flags().StringVar(&s.shortPath, "from", "", "Specify a name of a key pair (<name>.crt, <name>.key) from which you want to sign your certificate. This can be used insted of --sign-cert and --sign-key")
cmd.Flags().StringVar(&s.shortPath, "with", "", "Specify a name of a key pair (<name>.crt, <name>.key) which you want to sign your certificate with. This can be used insted of --sign-cert and --sign-key")
}

func (s *signPair) load() error {
Expand Down

0 comments on commit 8623c2c

Please sign in to comment.