keyStore

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AllTypes contains all possible variants of Type.

Functions

func LoadCertificateFromFile added in v0.1.6

func LoadCertificateFromFile(filename string) (*x509.Certificate, error)

LoadCertificateFromFile loads a certificate from given filename and return it.

Types

type Config

type Config struct {
	// @default generated
	//
	// Defines the type of instance keyStore.
	Type Type `json:"type" yaml:"type"`

	// @default ""
	//
	// Defines the pemFile which contains the key and certificate to use.
	// This have to be of type PEM and have to contain the certificate and private key.
	// Currently the private key is only supported of type RSA.
	//
	// This property is only evaluated and required if {@ref #Type type} is set to
	// {@ref .Type#FromFile fromFile}.
	PemFile values.String `json:"pemFile,omitempty" yaml:"pemFile"`

	// @default "algorithm:`rsa` bits:`1024`"
	//
	// Defines some hints for instance store in format “[<key:`value`>...]“.
	// Possible hints are:
	//
	// * “algorithm“: Algorithm to use for creation of new keys. Currently only “rsa“ is supported.
	// * “bits“: Number of bits to create a new key with.
	Hints values.String `json:"hints,omitempty" yaml:"hints"`

	// @default ""
	//
	// File where trusted certificates are stored in. This have to be in PEM format.
	CaFile values.String `json:"caFile,omitempty" yaml:"caFile"`
}

Description

Defines the keyStore of caretakerd.

func NewConfig

func NewConfig() Config

NewConfig creates a new instance of Config.

func (Config) GetHintsArgument added in v0.1.6

func (instance Config) GetHintsArgument(key string) string

GetHintsArgument returns hints argument content for the given key. If there is no hint for this key and empty string is returned.

func (Config) Validate

func (instance Config) Validate() error

Validate do validate action on this object and return an error object if any.

type KeyStore

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

KeyStore represents a keystore that holds certificates, CAs and private keys.

func NewKeyStore

func NewKeyStore(enabled bool, conf Config) (*KeyStore, error)

NewKeyStore create an new instance of KeyStore.

func (KeyStore) CA added in v0.1.6

func (instance KeyStore) CA() []*x509.Certificate

CA returns all containing CAs of this KeyStore.

func (KeyStore) Config

func (instance KeyStore) Config() Config

Config returns the Config instance this KeyStore was created with.

func (KeyStore) GeneratePem

func (instance KeyStore) GeneratePem(name string) ([]byte, *x509.Certificate, error)

GeneratePem generates a new PEM with config of current KeyStore instance and return it. This PEM will be stored at the KeyStore instance by this method.

func (KeyStore) IsCA

func (instance KeyStore) IsCA() bool

IsCA returns true if the containing certificate could use to create new certificates.

func (KeyStore) IsEnabled

func (instance KeyStore) IsEnabled() bool

IsEnabled returns true if this KeyStore is configured and usable.

func (KeyStore) PEM added in v0.1.6

func (instance KeyStore) PEM() []byte

PEM returns the containing PEM instance of this KeyStore. If there is no PEM the result is empty.

func (KeyStore) Type

func (instance KeyStore) Type() Type

Type returns the Type of this KeyStore.

type Type

type Type int

Description

Represents the type of the keyStore.

const (
	// @id generated
	// Indicates that caretakerd have to generate its own keyStore on startup.
	// This is the best solution in most cases.
	Generated Type = 0

	// @id fromFile
	// Load keyStore from a provided PEM file.
	// If instance type is selected instance file have to be provided.
	FromFile Type = 1

	// @id fromEnvironment
	// Load keyStore from the environment variable “CTD_PEM“ in PEM format.
	// If instance type is selected instance variable have to be provided.
	FromEnvironment Type = 2
)

func (Type) CheckedString

func (instance Type) CheckedString() (string, error)

CheckedString is like String but return also an optional error if there are some validation errors.

func (Type) IsConsumingCAFile added in v0.1.6

func (instance Type) IsConsumingCAFile() bool

IsConsumingCAFile returns true if the KeyStore instance created with this type can consumes a CA bundle file.

func (Type) IsGenerating

func (instance Type) IsGenerating() bool

IsGenerating returns true if the KeyStore instance created with this type will be generated.

func (Type) IsTakingFilename

func (instance Type) IsTakingFilename() bool

IsTakingFilename returns true if the KeyStore instance created with this type is created from file.

func (Type) MarshalJSON

func (instance Type) MarshalJSON() ([]byte, error)

MarshalJSON is used until json marshalling. Do not call directly.

func (Type) MarshalYAML

func (instance Type) MarshalYAML() (interface{}, error)

MarshalYAML is used until yaml marshalling. Do not call directly.

func (*Type) Set

func (instance *Type) Set(value string) error

Set the given string to current object from a string. Return an error object if there are some problems while transforming the string.

func (Type) String

func (instance Type) String() string

func (*Type) UnmarshalJSON

func (instance *Type) UnmarshalJSON(b []byte) error

UnmarshalJSON is used until json unmarshalling. Do not call directly.

func (*Type) UnmarshalYAML

func (instance *Type) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is used until yaml unmarshalling. Do not call directly.

func (Type) Validate

func (instance Type) Validate() error

Validate do validate action on this object and return an error object if any.

Jump to

Keyboard shortcuts

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