command

package
v0.0.0-...-35bd650 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2018 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package command implements the commands of shamironsalt

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskPass

func AskPass(prompt string, minlength int, confirm bool) (string, error)

AskPass asks for a password of minlength and confirms by double entry

func Command

func Command(args []string) error

Command is the shamironsalt command

func DisplayRequest

func DisplayRequest(IdentityFile, Password, RequestFile, SharesFile string, verbosity int) (string, error)

DisplayRequest displays information about the request

func GenKey

func GenKey(filename, password string) (string, error)

GenKey generates a key and writes it to the given file

func GenShareRequests

func GenShareRequests(outputFile, shareFile, identityFile, password string, verbosity int) (string, error)

GenShareRequests creates share requestsion in output from shares

func GenShares

func GenShares(secret, comment, recipientsFile, outputFile string, threshhold int, verbosity int) (string, error)

GenShares reads recipientsFile, adds secret and recipients to the share definition and creates shares in output

func Output

func Output()

Output prints the output of the command

func ParseRecipientsFile

func ParseRecipientsFile(recipientsFile string) ([]shares.ShareMember, error)

ParseRecipientsFile parses a recipient file and returns a list of share group members

func PrintError

func PrintError(format string, a ...interface{}) error

PrintError prints an error to stderr

func ReadFile

func ReadFile(filename string) ([]byte, error)

ReadFile reads all content from filename and returns it

func ReadKey

func ReadKey(filename, password string) (pubkey, privkey []byte, err error)

ReadKey reads a keypair from file

func Recover

func Recover(IdentityFile, Password, ShareFile, ResponseFile string, verbosity int) (string, error)

Recover recovers the secret from Sharefile and Responsefile

func RespondRequest

func RespondRequest(IdentityFile, Password, RequestFile, SharesFile, ResponseFile string, NumShares int, Fake bool, verbosity int) (string, error)

RespondRequest displays information about the request

func ShowKey

func ShowKey(filename, password string) (pubkey string, err error)

ShowKey displays the public key as hex (as required by the tool)

func WriteFile

func WriteFile(filename string, data []byte) error

WriteFile writes data into filename if filename does not exist

Types

type GenKeyCommand

type GenKeyCommand struct {
	FileName string `short:"k" long:"keyfile" description:"output filename" value-name:"FILE" required:"true"`
	Display  bool   `short:"d" long:"display" description:"show the public key contained in -k FILE"`
	Password string `short:"p" long:"password" description:"set a password for the key" value-name:"PASSWORD"`
	AskPass  bool   `short:"a" long:"askpassword" description:"ask for the password"`
}

GenKeyCommand options for this command

func (*GenKeyCommand) Execute

func (c *GenKeyCommand) Execute(args []string) error

Execute this command

type GenRequestCommand

type GenRequestCommand struct {
	FileName string `short:"o" long:"outfile" description:"output filename to write the requests to" value-name:"FILE" required:"true"`
	Shares   string `` /* 129-byte string literal not displayed */
	Identity string `` /* 129-byte string literal not displayed */
	Password string `short:"p" long:"password" description:"optional password to decrypto keypair" value-name:"PASSWORD"`
	AskPass  bool   `short:"a" long:"askpassword" description:"ask for the password"`
}

GenRequestCommand options for this command

func (*GenRequestCommand) Execute

func (c *GenRequestCommand) Execute(args []string) error

Execute this command

type GenSharesCommand

type GenSharesCommand struct {
	FileName   string `short:"o" long:"outfile" description:"output filename to write the shares to" value-name:"FILE" required:"true"`
	Recipients string `` /* 190-byte string literal not displayed */
	Threshold  int    `short:"t" long:"threshhold" description:"number of shares required for reconstruction" required:"true"`
	Comment    string `short:"c" long:"comment" description:"comment to describe the secret" value-name:"COMMENT" required:"true"`
	Secret     string `short:"s" long:"secret" description:"the secret to be shared. If not given it is read from STDIN" value-name:"SECRET"`
	AskSecret  bool   `short:"a" long:"asksecret" description:"ask for the secret"`
	Verbose    []bool `short:"v" description:"be verbose. Repeat for more verbosity"`
}

GenSharesCommand options for this command

func (*GenSharesCommand) Execute

func (c *GenSharesCommand) Execute(args []string) error

Execute this command

type RecoverCommand

type RecoverCommand struct {
	Shares    string `` /* 129-byte string literal not displayed */
	Identity  string `` /* 129-byte string literal not displayed */
	Password  string `short:"p" long:"password" description:"optional password to decrypto keypair" value-name:"PASSWORD"`
	Responses string `short:"r" long:"responses" description:"File containing responses to a share request" value-name:"FILE" required:"true"`
	Verbose   []bool `short:"v" description:"be verbose. Repeat for more verbosity"`
	AskPass   bool   `short:"a" long:"askpassword" description:"ask for the password"`
}

RecoverCommand CLI params

func (*RecoverCommand) Execute

func (c *RecoverCommand) Execute(args []string) error

Execute this command

type RespondRequestCommand

type RespondRequestCommand struct {
	Shares   string `` /* 129-byte string literal not displayed */
	Request  string `short:"r" long:"request" description:"file containing the share request" value-name:"FILE" required:"true"`
	Identity string `` /* 129-byte string literal not displayed */
	Password string `short:"p" long:"password" description:"optional password to decrypto keypair" value-name:"PASSWORD"`
	AskPass  bool   `short:"a" long:"askpassword" description:"ask for the password"`
	// Optional
	Display   bool   `short:"d" long:"display" description:"display information about request. Overrides -o"`
	FileName  string `` /* 161-byte string literal not displayed */
	Fake      bool   `short:"F" long:"fake" descrition:"answer with a fake"`
	AddShares int    `short:"R" long:"replyshares" description:"reply with NUMBER shares" value-name:"NUMBER" default:"255"`
	Verbose   []bool `short:"v" description:"be verbose. Repeat for more verbosity"`
}

RespondRequestCommand CLI params

func (*RespondRequestCommand) Execute

func (c *RespondRequestCommand) Execute(args []string) error

Execute this command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL