Documentation ¶
Index ¶
- Variables
- func LoadCertificateFromFile(filename string) (*x509.Certificate, error)
- type Config
- type KeyStore
- func (instance KeyStore) CA() []*x509.Certificate
- func (instance KeyStore) Config() Config
- func (instance KeyStore) GeneratePem(name string) ([]byte, *x509.Certificate, error)
- func (instance KeyStore) IsCA() bool
- func (instance KeyStore) IsEnabled() bool
- func (instance KeyStore) PEM() []byte
- func (instance KeyStore) Type() Type
- type Type
- func (instance Type) CheckedString() (string, error)
- func (instance Type) IsConsumingCAFile() bool
- func (instance Type) IsGenerating() bool
- func (instance Type) IsTakingFilename() bool
- func (instance Type) MarshalJSON() ([]byte, error)
- func (instance Type) MarshalYAML() (interface{}, error)
- func (instance *Type) Set(value string) error
- func (instance Type) String() string
- func (instance *Type) UnmarshalJSON(b []byte) error
- func (instance *Type) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (instance Type) Validate() error
Constants ¶
This section is empty.
Variables ¶
var AllTypes = []Type{ Generated, FromFile, FromEnvironment, }
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 the given filename and returns it.
Types ¶
type Config ¶
type Config struct { // @default generated // // Defines the type of the instance keyStore. Type Type `json:"type" yaml:"type"` // @default "" // // Defines the pemFile which contains the key and certificate to be used. // This has to be of type PEM and has to contain the certificate and private key. // Currently only private keys of type RSA are supported. // // 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 example to store in the format “[<key:`value`>...]“. // Possible hints are: // // * “algorithm“: Algorithm to be used to create 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 has to be in PEM format. CaFile values.String `json:"caFile,omitempty" yaml:"caFile"` }
Description ¶
Defines the keyStore of caretakerd.
func (Config) GetHintsArgument ¶ added in v0.1.6
GetHintsArgument returns hints argument content for the given key. If there is no hint for this key and empty string is returned.
type KeyStore ¶
type KeyStore struct {
// contains filtered or unexported fields
}
KeyStore represents a keystore that holds certificates, CAs and private keys.
func NewKeyStore ¶
NewKeyStore create an new instance of KeyStore.
func (KeyStore) CA ¶ added in v0.1.6
func (instance KeyStore) CA() []*x509.Certificate
CA returns all contained CAs of this KeyStore.
func (KeyStore) GeneratePem ¶
GeneratePem generates a new PEM with the config of the current KeyStore instance and returns it. This PEM will be stored in the KeyStore instance.
func (KeyStore) IsCA ¶
IsCA returns "true" if the contained certificate could be used to create new certificates.
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 this instance type is selected, the instance file have to be provided. FromFile Type = 1 // @id fromEnvironment // Load the KeyStore from the environment variable “CTD_PEM“ in PEM format. // If this instance type is selected, the instance variable have to be provided. FromEnvironment Type = 2 )
func (Type) CheckedString ¶
CheckedString is like String but also returns an optional error if there are any validation errors.
func (Type) IsConsumingCAFile ¶ added in v0.1.6
IsConsumingCAFile returns "true" if the KeyStore instance created with this type can consume a CA bundle file.
func (Type) IsGenerating ¶
IsGenerating returns "true" if the KeyStore instance created with this type will be generated.
func (Type) IsTakingFilename ¶
IsTakingFilename returns "true" if the KeyStore instance created with this type is created from file.
func (Type) MarshalJSON ¶
MarshalJSON is used until json marshalling. Do not call this method directly.
func (Type) MarshalYAML ¶
MarshalYAML is used until yaml marshalling. Do not call this method directly.
func (*Type) Set ¶
Set sets the given string to current object from a string. Returns an error object if there are any problems while transforming the string.
func (*Type) UnmarshalJSON ¶
UnmarshalJSON is used until json unmarshalling. Do not call this method directly.
func (*Type) UnmarshalYAML ¶
UnmarshalYAML is used until yaml unmarshalling. Do not call this method directly.