package flags import ( "encoding/json" "fmt" "net/url" "path/filepath" "strings" "time" "github.com/pkg/errors" "github.com/smallstep/certificates/api" "github.com/smallstep/cli/config" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/utils" "github.com/urfave/cli" ) var ( // KTY is the flag to set the key type. KTY = cli.StringFlag{ Name: "kty", Value: "EC", Usage: `The to build the certificate upon. If unset, default is EC. : is a case-sensitive string and must be one of: **EC** : Create an **elliptic curve** keypair **OKP** : Create an octet key pair (for **"Ed25519"** curve) **RSA** : Create an **RSA** keypair`, } // Size is the flag to set the key size. Size = cli.IntFlag{ Name: "size", Usage: `The (in bits) of the key for RSA and oct key types. RSA keys require a minimum key size of 2048 bits. If unset, default is 2048 bits for RSA keys and 128 bits for oct keys.`, } // Curve is the flag to se the key curve. Curve = cli.StringFlag{ Name: "crv, curve", Usage: `The elliptic to use for EC and OKP key types. Corresponds to the **"crv"** JWK parameter. Valid curves are defined in JWA [RFC7518]. If unset, default is P-256 for EC keys and Ed25519 for OKP keys. : is a case-sensitive string and must be one of: **P-256** : NIST P-256 Curve **P-384** : NIST P-384 Curve **P-521** : NIST P-521 Curve **Ed25519** : Ed25519 Curve`, } // Subtle is the flag required for delicate operations. Subtle = cli.BoolFlag{ Name: "subtle", } // Insecure is the flag required on insecure operations Insecure = cli.BoolFlag{ Name: "insecure", } // K8sSATokenPathFlag is an optional flag that allows modification of the // kubernetes service account token path. K8sSATokenPathFlag = cli.StringFlag{ Name: "k8ssa-token-path", Usage: `Configure the from which to read the kubernetes service account token.`, Value: `/var/run/secrets/kubernetes.io/serviceaccount/token`, } // Force is a cli.Flag used to overwrite files. Force = cli.BoolFlag{ Name: "f,force", Usage: "Force the overwrite of files without asking.", } // DryRun is a cli.Flag used to avoid the writing of files. DryRun = cli.BoolFlag{ Name: "dry-run", Usage: "Executes the command without changing any file.", } // PasswordFile is a cli.Flag used to pass a file to encrypt or decrypt a // private key. PasswordFile = cli.StringFlag{ Name: "password-file", Usage: `The path to the containing the password to encrypt or decrypt the private key.`, } // NoPassword is a cli.Flag used to avoid using a password to encrypt private // keys. NoPassword = cli.BoolFlag{ Name: "no-password", Usage: `Do not ask for a password to encrypt a private key. Sensitive key material will be written to disk unencrypted. This is not recommended. Requires **--insecure** flag.`, } // Token is a cli.Flag used to pass the CA token. Token = cli.StringFlag{ Name: "token", Usage: `The one-time used to authenticate with the CA in order to create the certificate.`, } // NotBefore is a cli.Flag used to pass the start period of the certificate // validity. NotBefore = cli.StringFlag{ Name: "not-before", Usage: `The when the certificate validity period starts. If a