Documentation
¶
Overview ¶
Package auth_method_pem implements a PEM backup key auth method.
Index ¶
- Constants
- func GenerateBackupKey() (privPem []byte, pubPem []byte, err error)
- func NewMethod(ctx context.Context, le *logrus.Entry, handler auth_method.Handler) (auth_method.Method, error)
- type PemMethod
- func (p *PemMethod) Authenticate(paramsi auth_method.Parameters, authSecretData []byte) (crypto.PrivKey, error)
- func (p *PemMethod) Close()
- func (p *PemMethod) Execute(ctx context.Context) error
- func (p *PemMethod) GetMethodID() string
- func (p *PemMethod) UnmarshalParameters(data []byte) (auth_method.Parameters, error)
- type PemParameters
Constants ¶
const MethodID = "pem"
MethodID is the auth method ID for PEM backup keys.
Variables ¶
This section is empty.
Functions ¶
func GenerateBackupKey ¶
GenerateBackupKey creates a new Ed25519 keypair for PEM backup. Returns the private key PEM and public key PEM bytes.
Types ¶
type PemMethod ¶
type PemMethod struct{}
PemMethod implements the auth method interface for PEM backup keys.
func (*PemMethod) Authenticate ¶
func (p *PemMethod) Authenticate(paramsi auth_method.Parameters, authSecretData []byte) (crypto.PrivKey, error)
Authenticate authenticates with existing auth parameters. authSecretData is the full PEM private key file bytes.
func (*PemMethod) Close ¶
func (p *PemMethod) Close()
Close closes all resources related to the auth method.
func (*PemMethod) GetMethodID ¶
GetMethodID returns the auth method ID.
func (*PemMethod) UnmarshalParameters ¶
func (p *PemMethod) UnmarshalParameters(data []byte) (auth_method.Parameters, error)
UnmarshalParameters unmarshals+validates parameters from binary. The data is the PEM-encoded public key bytes.
type PemParameters ¶
type PemParameters struct {
// PubKeyPem is the PEM-encoded public key bytes.
PubKeyPem []byte
}
PemParameters stores the PEM-encoded public key for verification.
func (*PemParameters) MarshalBlock ¶
func (p *PemParameters) MarshalBlock() ([]byte, error)
MarshalBlock marshals the parameters to binary.
func (*PemParameters) Validate ¶
func (p *PemParameters) Validate() error
Validate validates the parameters by parsing the PEM public key.