Documentation
¶
Index ¶
- Constants
- Variables
- func Fail(err error)
- func GetKeyDetailsFromCLI(ctx *cli.Context, insecure bool, ktyKey, curveKey, sizeKey string) (string, string, int, error)
- func ReadAll(r io.Reader) ([]byte, error)
- func ReadFile(name string) (b []byte, err error)
- func ReadInput(prompt string) ([]byte, error)
- func ReadPasswordFromFile(filename string) ([]byte, error)
- func ReadString(r io.Reader) (string, error)
- func ReadStringPasswordFromFile(filename string) (string, error)
- func WriteFile(filename string, data []byte, perm os.FileMode) error
Constants ¶
const DefaultECCurve = "P-256"
DefaultECCurve sets the default curve for EC to P-256.
const DefaultRSASize = 2048
DefaultRSASize sets the default key size for RSA to 2048 bits.
Variables ¶
Functions ¶
func Fail ¶
func Fail(err error)
Fail prints out the error struct if STEPDEBUG is true otherwise it just prints out the error message. Finally, it exits with an error code of 1.
func GetKeyDetailsFromCLI ¶
func GetKeyDetailsFromCLI(ctx *cli.Context, insecure bool, ktyKey, curveKey, sizeKey string) (string, string, int, error)
GetKeyDetailsFromCLI gets the key pair algorithm, curve, and size inputs from the CLI context.
func ReadAll ¶
ReadAll returns a slice of bytes with the content of the given reader.
func ReadFile ¶
ReadFile returns the contents of the file identified by name. It reads from STDIN if name is a hyphen ("-").
func ReadInput ¶
ReadInput from stdin if something is detected or ask the user for an input using the given prompt.
func ReadPasswordFromFile ¶
ReadPasswordFromFile reads and returns the password from the given filename. The contents of the file will be trimmed at the right.
func ReadString ¶
ReadString reads one line from the given io.Reader.
func ReadStringPasswordFromFile ¶
ReadStringPasswordFromFile reads and returns the password from the given filename. The contents of the file will be trimmed at the right.
func WriteFile ¶
WriteFile wraps ioutil.WriteFile with a prompt to overwrite a file if the file exists. It returns ErrFileExists if the user picks to not overwrite the file. If force is set to true, the prompt will not be presented and the file if exists will be overwritten.
Types ¶
This section is empty.
Source Files
¶
- cli.go
- read.go
- utils.go
- write.go