keys

package
v0.0.0-...-982e07a Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdGenerate        = "generate"
	CmdListKeys        = "list"
	CmdExportKeys      = "export"
	CmdImportKeys      = "import"
	CmdMigrateKeys     = "migrate"
	CmdReadKey         = "read"
	CmdDestroyKey      = "destroy"
	CmdExtractClientID = "extract-client-id"
)

Sub-command names:

View Source
const (
	SrcMasterKeyVarName = "SRC_" + keystore.AcraMasterKeyVarName
	DstMasterKeyVarName = "DST_" + keystore.AcraMasterKeyVarName
)

Environment variables from which master keys are read.

View Source
const DefaultKeyDirectory = keystoreV1.DefaultKeyDirShort

DefaultKeyDirectory is the default path to key directory.

View Source
const ExportKeyPerm = os.FileMode(0600)

ExportKeyPerm is file permissions required for exported key data.

View Source
const ServiceName = "acra-keys"

ServiceName constant for logging and configuration parsing.

Variables

View Source
var (
	ErrUnknownSubCommand = errors.New("unknown command")
	ErrMissingKeyKind    = errors.New("missing key kind")
	ErrMissingKeyID      = errors.New("missing key IDs")
	ErrMultipleKeyKinds  = errors.New("multiple key kinds")
	ErrMissingOutputFile = errors.New("output file not specified")
	ErrOutputSame        = errors.New("output files are the same")
)

Command-line parsing errors:

View Source
var (
	ErrMissingKeystoreVersion = errors.New("keystore version not specified")
	ErrUnknownKeystoreVersion = errors.New("unknown keystore version")
)

Key generation errors:

View Source
var (
	ErrMissingFormat = errors.New("keystore format not specified")
	ErrMissingKeyDir = errors.New("keys directory not specified")
)

Command-line errors for "acra-keys migrate":

View Source
var (
	ErrMissingClientID             = errors.New("client ID not specified")
	ErrUnknownKeyKind              = errors.New("unknown key kind")
	ErrMissingKeyPart              = errors.New("key part not specified")
	ErrExtraKeyPart                = errors.New("both key parts specified")
	ErrMissingTLSCertPath          = errors.New("TLS certificate path not specified")
	ErrDuplicatedTLSCertPathFlags  = errors.New("passed --tls_cert (deprecated since 0.96.0) and --tls_client_id_cert simultaneously")
	ErrClientIDWithTLSCertProvided = errors.New("client ID and TLS certificate path are both provided")
)

Key parameter errors:

View Source
var DefaultConfigPath = utils.GetConfigPathByName("acra-keys")

DefaultConfigPath is the default path to service configuration file.

View Source
var (
	ErrIncorrectPerm = errors.New("incorrect output file permissions")
)

Key export errors:

View Source
var ErrInvalidIndex = errors.New("invalid index value provided")

ErrInvalidIndex error represent invalid index for --index flag

View Source
var (
	ErrNotImplementedV1 = errors.New("not implemented for keystore v1")
)

KeyStoreFactory should return one of those errors when it is not able to construct requested keystore.

View Source
var SupportedDestroyKeyKinds = []string{}

SupportedDestroyKeyKinds is a list of keys supported by `destroy-key` subcommand.

SupportedReadKeyKinds is a list of keys supported by `read-key` subcommand.

Functions

func DestroyKey

func DestroyKey(params DestroyKeyParams, keyStore keystore.KeyMaking) error

DestroyKey destroys data of the requsted key.

func DestroyKeyCommand

func DestroyKeyCommand(params DestroyKeyParams, keyStore keystore.KeyMaking)

DestroyKeyCommand implements the "destroy" command.

func ExportKeysCommand

func ExportKeysCommand(exporter ExportKeysParams)

ExportKeysCommand implements the "export" command.

func ExtractClientID

func ExtractClientID(params ExtractClientIDParams) (string, error)

ExtractClientID extract clientID based on ExtractClientIDParams.

func GenerateAcraKeys

func GenerateAcraKeys(params GenerateKeyParams, keyStore keystore.KeyMaking, defaultKeys DefaultKeyAction) (bool, error)

GenerateAcraKeys generates Acra CE keys as specified by the parameters. Returns true if some keys have been generated.

func GenerateMasterKey

func GenerateMasterKey(params GenerateKeyParams) error

GenerateMasterKey generates master key into output file.

func ImportKeysCommand

func ImportKeysCommand(params ImportKeysParams)

ImportKeysCommand implements the "import" command.

func IsKeyStoreV1

func IsKeyStoreV1(params KeyStoreParameters) bool

IsKeyStoreV1 checks if the directory contains a keystore version 1 from KeyStoreParameters

func IsKeyStoreV2

func IsKeyStoreV2(params KeyStoreParameters) bool

IsKeyStoreV2 checks if the directory contains a keystore version 2 from KeyStoreParameters

func ListKeysCommand

func ListKeysCommand(params ListKeysParams, keyStore keystore.ServerKeyStore)

ListKeysCommand implements the "list" command.

func MigrateV1toV2

func MigrateV1toV2(srcV1 filesystem.KeyExport, dstV2 keystoreV2.KeyFileImportV1) error

MigrateV1toV2 transfers keys from keystore v1 to v2.

func OpenKeyStoreForExport

func OpenKeyStoreForExport(params KeyStoreParameters) (api.KeyStore, error)

OpenKeyStoreForExport opens a keystore suitable for export operations.

func OpenKeyStoreForImport

func OpenKeyStoreForImport(params KeyStoreParameters) (api.MutableKeyStore, error)

OpenKeyStoreForImport opens a keystore suitable for import operations.

func OpenKeyStoreForReading

func OpenKeyStoreForReading(params KeyStoreParameters) (keystore.ServerKeyStore, error)

OpenKeyStoreForReading opens a keystore suitable for reading keys.

func OpenKeyStoreForWriting

func OpenKeyStoreForWriting(params KeyStoreParameters) (keyStore keystore.KeyMaking, err error)

OpenKeyStoreForWriting opens a keystore suitable for modifications.

func ParseKeyKind

func ParseKeyKind(keyID string) (string, []byte, error)

ParseKeyKind parses key ID of form "client/Alice/storage" and returns key kind and possible ID.

func PrintKeys

func PrintKeys(keys []keystore.KeyDescription, writer io.Writer, params ListKeysParams) error

PrintKeys prints key list prettily into the given writer.

func ReadKeyBytes

func ReadKeyBytes(params ReadKeyParams, keyStore keystore.ServerKeyStore) ([]byte, error)

ReadKeyBytes returns plaintext bytes of the requsted key.

func ValidateClientID

func ValidateClientID(params GenerateKeyParams) error

ValidateClientID checks that client ID is specified correctly.

func WriteExportedData

func WriteExportedData(data, keys []byte, params ExportKeysParams) error

WriteExportedData saves exported key data and ephemeral keys into designated files.

Types

type CommonExportImportParameters

type CommonExportImportParameters struct {
	// contains filtered or unexported fields
}

CommonExportImportParameters are common parameters of "acra-keys export" and "acra-keys import" subcommand.

func (*CommonExportImportParameters) ExportDataFile

func (p *CommonExportImportParameters) ExportDataFile() string

ExportDataFile returns path to file with encrypted exported key data.

func (*CommonExportImportParameters) ExportKeysFile

func (p *CommonExportImportParameters) ExportKeysFile() string

ExportKeysFile returns path to file with encryption keys for export.

func (*CommonExportImportParameters) Register

func (p *CommonExportImportParameters) Register(flags *flag.FlagSet, filePurspose string)

Register registers keystore flags with the given flag set.

type CommonExtractClientIDParameters

type CommonExtractClientIDParameters struct {
	// contains filtered or unexported fields
}

CommonExtractClientIDParameters is a mix-in of command line parameters for extracting clientID from TLS certificate.

func (*CommonExtractClientIDParameters) PrintJSON

func (p *CommonExtractClientIDParameters) PrintJSON() bool

PrintJSON tells if machine-readable JSON should be used.

func (*CommonExtractClientIDParameters) Register

func (p *CommonExtractClientIDParameters) Register(flags *flag.FlagSet)

Register registers key formatting flags with the given flag set.

func (*CommonExtractClientIDParameters) TLSClientCert

func (p *CommonExtractClientIDParameters) TLSClientCert() string

TLSClientCert returns path to TLS certificate path file to extract ID from.

func (*CommonExtractClientIDParameters) TLSIdentifierExtractorType

func (p *CommonExtractClientIDParameters) TLSIdentifierExtractorType() string

TLSIdentifierExtractorType returns TLS identifier extractor type based on which ID will be extracted.

type CommonKeyListingParameters

type CommonKeyListingParameters struct {
	// contains filtered or unexported fields
}

CommonKeyListingParameters is a mix-in of command line parameters for keystore listing.

func (*CommonKeyListingParameters) ListRotatedKeys

func (p *CommonKeyListingParameters) ListRotatedKeys() bool

ListRotatedKeys return param if command should display rotated keys.

func (*CommonKeyListingParameters) Register

func (p *CommonKeyListingParameters) Register(flags *flag.FlagSet)

Register registers key formatting flags with the given flag set.

func (*CommonKeyListingParameters) UseJSON

func (p *CommonKeyListingParameters) UseJSON() bool

UseJSON tells if machine-readable JSON should be used.

type CommonKeyStoreParameters

type CommonKeyStoreParameters struct {
	// contains filtered or unexported fields
}

CommonKeyStoreParameters is a mix-in of command line parameters for keystore construction.

func (*CommonKeyStoreParameters) GetExtractor

func (p *CommonKeyStoreParameters) GetExtractor() *args.ServiceExtractor

GetExtractor ServiceParamsExtractor.

func (*CommonKeyStoreParameters) GetFlagSet

func (p *CommonKeyStoreParameters) GetFlagSet() *flag.FlagSet

GetFlagSet return subcommand FlagSet

func (*CommonKeyStoreParameters) KeyDir

func (p *CommonKeyStoreParameters) KeyDir() string

KeyDir returns path to key directory.

func (*CommonKeyStoreParameters) KeyDirPublic

func (p *CommonKeyStoreParameters) KeyDirPublic() string

KeyDirPublic returns path to public key directory (if different from key directory).

func (*CommonKeyStoreParameters) Register

func (p *CommonKeyStoreParameters) Register(flags *flag.FlagSet)

Register registers keystore flags with the given flag set.

func (*CommonKeyStoreParameters) RegisterPrefixed

func (p *CommonKeyStoreParameters) RegisterPrefixed(flags *flag.FlagSet, defaultKeysDir, flagPrefix, descriptionSuffix string)

RegisterPrefixed registers keystore flags with the given flag set, using given prefix and description.

type DefaultKeyAction

type DefaultKeyAction int

DefaultKeyAction defines how GenerateAcraKeys() handles the default key set.

const (
	// Automatically generate default set of keys if no keys were requested and the keystore is empty.
	GenerateOnInitialize DefaultKeyAction = iota
	// Generate only the explicitly requested keys.
	GenerateAsRequested
	// Generate default set of keys regardless of the requested keys.
	GenerateDefaultsOverride
)

Allowed values of DefaultKeyAction.

type DestroyKeyParams

type DestroyKeyParams interface {
	DestroyKeyKind() string
	ClientID() []byte
	Index() int
}

DestroyKeyParams are parameters of "acra-keys destroy" subcommand.

type DestroyKeySubcommand

type DestroyKeySubcommand struct {
	CommonKeyStoreParameters
	FlagSet *flag.FlagSet
	// contains filtered or unexported fields
}

DestroyKeySubcommand is the "acra-keys destroy" subcommand.

func (*DestroyKeySubcommand) ClientID

func (p *DestroyKeySubcommand) ClientID() []byte

ClientID returns client ID of the requested key.

func (*DestroyKeySubcommand) DestroyKeyKind

func (p *DestroyKeySubcommand) DestroyKeyKind() string

DestroyKeyKind returns requested kind of the key to destroy.

func (*DestroyKeySubcommand) Execute

func (p *DestroyKeySubcommand) Execute()

Execute this subcommand.

func (*DestroyKeySubcommand) GetExtractor

func (p *DestroyKeySubcommand) GetExtractor() *args.ServiceExtractor

GetExtractor ServiceParamsExtractor.

func (*DestroyKeySubcommand) GetFlagSet

func (p *DestroyKeySubcommand) GetFlagSet() *flag.FlagSet

GetFlagSet returns flag set of this subcommand.

func (*DestroyKeySubcommand) Index

func (p *DestroyKeySubcommand) Index() int

Index returns index of key to be destroyed.

func (*DestroyKeySubcommand) Name

func (p *DestroyKeySubcommand) Name() string

Name returns the same of this subcommand.

func (*DestroyKeySubcommand) Parse

func (p *DestroyKeySubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*DestroyKeySubcommand) RegisterFlags

func (p *DestroyKeySubcommand) RegisterFlags()

RegisterFlags registers command-line flags of "acra-keys read".

type ExportImportCommonParams

type ExportImportCommonParams interface {
	ExportKeysFile() string
	ExportDataFile() string
}

ExportImportCommonParams are common parameters of "acra-keys export" and "acra-keys import" subcommand.

type ExportKeysParams

type ExportKeysParams interface {
	keystore.Exporter
	ExportImportCommonParams
	ExportIDs() []keystore.ExportID
	ExportAll() bool
	ExportPrivate() bool
}

ExportKeysParams are parameters of "acra-keys export" subcommand.

type ExportKeysSubcommand

type ExportKeysSubcommand struct {
	CommonKeyStoreParameters
	CommonExportImportParameters
	FlagSet *flag.FlagSet
	// contains filtered or unexported fields
}

ExportKeysSubcommand is the "acra-keys export" subcommand.

func (*ExportKeysSubcommand) Execute

func (p *ExportKeysSubcommand) Execute()

Execute this subcommand.

func (*ExportKeysSubcommand) Export

Export implements keystore.Exporter interface

func (*ExportKeysSubcommand) ExportAll

func (p *ExportKeysSubcommand) ExportAll() bool

ExportAll returns true if all keys should be exported, regardless of ExportIDs() value.

func (*ExportKeysSubcommand) ExportIDs

func (p *ExportKeysSubcommand) ExportIDs() []keystore.ExportID

ExportIDs returns key IDs to export.

func (*ExportKeysSubcommand) ExportPrivate

func (p *ExportKeysSubcommand) ExportPrivate() bool

ExportPrivate returns true if private keys should be included into exported data.

func (*ExportKeysSubcommand) GetExtractor

func (p *ExportKeysSubcommand) GetExtractor() *args.ServiceExtractor

GetExtractor return ServiceParamsExtractor

func (*ExportKeysSubcommand) GetFlagSet

func (p *ExportKeysSubcommand) GetFlagSet() *flag.FlagSet

GetFlagSet returns flag set of this subcommand.

func (*ExportKeysSubcommand) Name

func (p *ExportKeysSubcommand) Name() string

Name returns the same of this subcommand.

func (*ExportKeysSubcommand) Parse

func (p *ExportKeysSubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*ExportKeysSubcommand) RegisterFlags

func (p *ExportKeysSubcommand) RegisterFlags()

RegisterFlags registers command-line flags of "acra-keys export".

type ExtractClientIDParams

type ExtractClientIDParams interface {
	TLSClientCert() string
	TLSIdentifierExtractorType() string
}

ExtractClientIDParams are parameters of "acra-keys extract-client-id" subcommand.

type ExtractClientIDSubcommand

type ExtractClientIDSubcommand struct {
	CommonExtractClientIDParameters
	// contains filtered or unexported fields
}

ExtractClientIDSubcommand is the "acra-keys extract-client-id" subcommand.

func (*ExtractClientIDSubcommand) Execute

func (p *ExtractClientIDSubcommand) Execute()

Execute this subcommand.

func (*ExtractClientIDSubcommand) GetFlagSet

func (p *ExtractClientIDSubcommand) GetFlagSet() *flag.FlagSet

GetFlagSet returns flag set of this subcommand.

func (*ExtractClientIDSubcommand) Name

Name returns the same of this subcommand.

func (*ExtractClientIDSubcommand) Parse

func (p *ExtractClientIDSubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*ExtractClientIDSubcommand) RegisterFlags

func (p *ExtractClientIDSubcommand) RegisterFlags()

RegisterFlags registers command-line flags of "acra-keys import".

type GenerateKeyParams

type GenerateKeyParams interface {
	KeyStoreParameters
	KeystoreVersion() string

	GenerateMasterKeyFile() string

	ClientID() []byte
	GenerateAcraWriter() bool
	GenerateAcraBlocks() bool
	GenerateSearchHMAC() bool
	GeneratePoisonRecord() bool
	GenerateAuditLog() bool
	SetClientID(clientID string)
	TLSClientCert() string
	TLSIdentifierExtractorType() string

	SpecificKeysRequested() bool
}

GenerateKeyParams are parameters of "acra-keys generate" subcommand.

type GenerateKeySubcommand

type GenerateKeySubcommand struct {
	CommonExtractClientIDParameters
	CommonKeyStoreParameters
	// contains filtered or unexported fields
}

GenerateKeySubcommand is the "acra-keys generate" subcommand.

func (*GenerateKeySubcommand) ClientID

func (g *GenerateKeySubcommand) ClientID() []byte

ClientID returns client ID.

func (*GenerateKeySubcommand) Execute

func (g *GenerateKeySubcommand) Execute()

Execute this subcommand.

func (*GenerateKeySubcommand) GenerateAcraBlocks

func (g *GenerateKeySubcommand) GenerateAcraBlocks() bool

GenerateAcraBlocks get acraBlocks flag

func (*GenerateKeySubcommand) GenerateAcraWriter

func (g *GenerateKeySubcommand) GenerateAcraWriter() bool

GenerateAcraWriter returns true if new AcraWriter key was requested.

func (*GenerateKeySubcommand) GenerateAuditLog

func (g *GenerateKeySubcommand) GenerateAuditLog() bool

GenerateAuditLog get auditLog flag

func (*GenerateKeySubcommand) GenerateMasterKeyFile

func (g *GenerateKeySubcommand) GenerateMasterKeyFile() string

GenerateMasterKeyFile returns path to output file for master key. Returns empty string if master key has not been requested.

func (*GenerateKeySubcommand) GeneratePoisonRecord

func (g *GenerateKeySubcommand) GeneratePoisonRecord() bool

GeneratePoisonRecord get poisonRecord flag

func (*GenerateKeySubcommand) GenerateSearchHMAC

func (g *GenerateKeySubcommand) GenerateSearchHMAC() bool

GenerateSearchHMAC get searchHMAC flag

func (*GenerateKeySubcommand) GetExtractor

func (g *GenerateKeySubcommand) GetExtractor() *args.ServiceExtractor

GetParamsExtractor return service params extractor

func (*GenerateKeySubcommand) GetFlagSet

func (g *GenerateKeySubcommand) GetFlagSet() *flag.FlagSet

GetFlagSet returns flag set of this subcommand.

func (*GenerateKeySubcommand) KeystoreVersion

func (g *GenerateKeySubcommand) KeystoreVersion() string

KeystoreVersion returns requested keystore version.

func (*GenerateKeySubcommand) Name

func (g *GenerateKeySubcommand) Name() string

Name returns the same of this subcommand.

func (*GenerateKeySubcommand) Parse

func (g *GenerateKeySubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*GenerateKeySubcommand) RegisterFlags

func (g *GenerateKeySubcommand) RegisterFlags()

RegisterFlags registers command-line flags of "acra-keys generate".

func (*GenerateKeySubcommand) SetClientID

func (g *GenerateKeySubcommand) SetClientID(clientID string)

SetClientID set specific client ID.

func (*GenerateKeySubcommand) SpecificKeysRequested

func (g *GenerateKeySubcommand) SpecificKeysRequested() bool

SpecificKeysRequested returns true if the user has requested any key specifically. It returns false if no keys were requested.

type ImportKeysParams

type ImportKeysParams interface {
	keystore.Importer
	ExportImportCommonParams
	ListKeysParams
}

ImportKeysParams are parameters of "acra-keys import" subcommand.

type ImportKeysSubcommand

type ImportKeysSubcommand struct {
	CommonKeyStoreParameters
	CommonExportImportParameters
	CommonKeyListingParameters
	FlagSet *flag.FlagSet
	// contains filtered or unexported fields
}

ImportKeysSubcommand is the "acra-keys import" subcommand.

func (*ImportKeysSubcommand) Execute

func (p *ImportKeysSubcommand) Execute()

Execute this subcommand.

func (*ImportKeysSubcommand) GetExtractor

func (p *ImportKeysSubcommand) GetExtractor() *args.ServiceExtractor

GetExtractor return ServiceParamsExtractor

func (*ImportKeysSubcommand) GetFlagSet

func (p *ImportKeysSubcommand) GetFlagSet() *flag.FlagSet

GetFlagSet returns flag set of this subcommand.

func (*ImportKeysSubcommand) Import

Import implements keystore.Importer interface

func (*ImportKeysSubcommand) Name

func (p *ImportKeysSubcommand) Name() string

Name returns the same of this subcommand.

func (*ImportKeysSubcommand) Parse

func (p *ImportKeysSubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*ImportKeysSubcommand) RegisterFlags

func (p *ImportKeysSubcommand) RegisterFlags()

RegisterFlags registers command-line flags of "acra-keys import".

type KeyStoreParameters

type KeyStoreParameters interface {
	GetFlagSet() *flag.FlagSet
	GetExtractor() *args.ServiceExtractor

	KeyDir() string
	KeyDirPublic() string
}

KeyStoreParameters are parameters for DefaultKeyStoreFactory.

type ListKeySubcommand

type ListKeySubcommand struct {
	CommonKeyStoreParameters
	CommonKeyListingParameters
	FlagSet *flag.FlagSet
	// contains filtered or unexported fields
}

ListKeySubcommand is the "acra-keys list" subcommand.

func (*ListKeySubcommand) Execute

func (p *ListKeySubcommand) Execute()

Execute this subcommand.

func (*ListKeySubcommand) GetExtractor

func (p *ListKeySubcommand) GetExtractor() *args.ServiceExtractor

GetExtractor return ServiceParamsExtractor

func (*ListKeySubcommand) GetFlagSet

func (p *ListKeySubcommand) GetFlagSet() *flag.FlagSet

GetFlagSet returns flag set of this subcommand.

func (*ListKeySubcommand) Name

func (p *ListKeySubcommand) Name() string

Name returns the same of this subcommand.

func (*ListKeySubcommand) Parse

func (p *ListKeySubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*ListKeySubcommand) RegisterFlags

func (p *ListKeySubcommand) RegisterFlags()

RegisterFlags registers command-line flags of "acra-keys list".

type ListKeysParams

type ListKeysParams interface {
	UseJSON() bool
	ListRotatedKeys() bool
}

ListKeysParams ara parameters of "acra-keys list" subcommand.

type MigrateKeysParams

type MigrateKeysParams interface {
	SrcKeyStoreVersion() string
	SrcKeyStoreParams() KeyStoreParameters
	DstKeyStoreVersion() string
	DstKeyStoreParams() KeyStoreParameters
	DryRun() bool
	ForceWrite() bool
}

MigrateKeysParams ara parameters of "acra-keys migrate" subcommand.

type MigrateKeysSubcommand

type MigrateKeysSubcommand struct {
	// contains filtered or unexported fields
}

MigrateKeysSubcommand is the "acra-keys migrate" subcommand.

func (*MigrateKeysSubcommand) DryRun

func (m *MigrateKeysSubcommand) DryRun() bool

DryRun returns true if only a dry run requested, without actual migration.

func (*MigrateKeysSubcommand) DstKeyStoreParams

func (m *MigrateKeysSubcommand) DstKeyStoreParams() KeyStoreParameters

DstKeyStoreParams returns parameters of the destination keystore.

func (*MigrateKeysSubcommand) DstKeyStoreVersion

func (m *MigrateKeysSubcommand) DstKeyStoreVersion() string

DstKeyStoreVersion returns destination keystore version.

func (*MigrateKeysSubcommand) Execute

func (m *MigrateKeysSubcommand) Execute()

Execute this subcommand.

func (*MigrateKeysSubcommand) ForceWrite

func (m *MigrateKeysSubcommand) ForceWrite() bool

ForceWrite returns true if migration is allowed to overwrite existing destination keystore.

func (*MigrateKeysSubcommand) GetExtractor

func (m *MigrateKeysSubcommand) GetExtractor() *args.ServiceExtractor

GetExtractor return ServiceParamsExtractor

func (*MigrateKeysSubcommand) GetFlagSet

func (m *MigrateKeysSubcommand) GetFlagSet() *flag.FlagSet

GetFlagSet returns flag set of this subcommand.

func (*MigrateKeysSubcommand) Name

func (m *MigrateKeysSubcommand) Name() string

Name returns the same of this subcommand.

func (*MigrateKeysSubcommand) Parse

func (m *MigrateKeysSubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*MigrateKeysSubcommand) RegisterFlags

func (m *MigrateKeysSubcommand) RegisterFlags()

RegisterFlags registers command-line flags of "acra-keys migrate".

func (*MigrateKeysSubcommand) SrcKeyStoreParams

func (m *MigrateKeysSubcommand) SrcKeyStoreParams() KeyStoreParameters

SrcKeyStoreParams returns parameters of the source keystore.

func (*MigrateKeysSubcommand) SrcKeyStoreVersion

func (m *MigrateKeysSubcommand) SrcKeyStoreVersion() string

SrcKeyStoreVersion returns source keystore version.

type ReadKeyParams

type ReadKeyParams interface {
	ReadKeyKind() string
	ClientID() []byte
}

ReadKeyParams are parameters of "acra-keys read" subcommand.

type ReadKeySubcommand

type ReadKeySubcommand struct {
	CommonKeyStoreParameters
	FlagSet *flag.FlagSet
	// contains filtered or unexported fields
}

ReadKeySubcommand is the "acra-keys read" subcommand.

func (*ReadKeySubcommand) ClientID

func (p *ReadKeySubcommand) ClientID() []byte

ClientID returns client ID of the requested key.

func (*ReadKeySubcommand) Execute

func (p *ReadKeySubcommand) Execute()

Execute this subcommand.

func (*ReadKeySubcommand) GetExtractor

func (p *ReadKeySubcommand) GetExtractor() *args.ServiceExtractor

GetExtractor returns ServiceParamsExtractor extractor

func (*ReadKeySubcommand) GetFlagSet

func (p *ReadKeySubcommand) GetFlagSet() *flag.FlagSet

GetFlagSet returns flag set of this subcommand.

func (*ReadKeySubcommand) Name

func (p *ReadKeySubcommand) Name() string

Name returns the name of this subcommand.

func (*ReadKeySubcommand) Parse

func (p *ReadKeySubcommand) Parse(arguments []string) error

Parse command-line parameters of the subcommand.

func (*ReadKeySubcommand) PrintKeyCommand

func (p *ReadKeySubcommand) PrintKeyCommand(params ReadKeyParams, keyStore keystore.ServerKeyStore)

PrintKeyCommand implements the "read" command.

func (*ReadKeySubcommand) ReadKeyKind

func (p *ReadKeySubcommand) ReadKeyKind() string

ReadKeyKind returns kind of the requested key.

func (*ReadKeySubcommand) RegisterFlags

func (p *ReadKeySubcommand) RegisterFlags()

RegisterFlags registers command-line flags of "acra-keys read".

type Subcommand

type Subcommand interface {
	Name() string
	RegisterFlags()
	GetFlagSet() *flag.FlagSet
	Parse(arguments []string) error
	Execute()
}

Subcommand is "acra-keys" subcommand, like "acra-keys export".

func ParseParameters

func ParseParameters(subcommands []Subcommand) Subcommand

ParseParameters parses command-line parameters and returns the selected subcommand. There may be no subcommand selected, in which case nil is returned. It terminates the process on error.

Jump to

Keyboard shortcuts

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