Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GpgSigningKey ¶
GpgSigningKey is a struct that implements SigningKey interface for GPG keys
func (*GpgSigningKey) CreateSignature ¶
func (sk *GpgSigningKey) CreateSignature(contentToSign []byte) ([]byte, error)
CreateSignature creates a gpg signature
func (*GpgSigningKey) Verify ¶
func (sk *GpgSigningKey) Verify(signature, signedText []byte) error
Verify method verifies whether a signature has been created by this signing key
type SSHSigningKey ¶
SSHSigningKey is a struct that implements SigningKey interface for SSH keys
func (*SSHSigningKey) CreateSignature ¶
func (sk *SSHSigningKey) CreateSignature(contentToSign []byte) ([]byte, error)
CreateSignature creates an SSH signature
func (*SSHSigningKey) Verify ¶
func (sk *SSHSigningKey) Verify(signatureText, signedText []byte) error
Verify method verifies whether a signature has been created by this signing key
type SigningKey ¶
SigningKey is the common interface of SSH and GPG signing keys
type SigningKeys ¶ added in v16.4.0
type SigningKeys struct {
// contains filtered or unexported fields
}
SigningKeys represents all signing keys configured in the system. The primary key is used for creating signatures, the secondary keys are used for verification if the primary key failed to verify a signature
func ParseSigningKeys ¶ added in v16.4.0
func ParseSigningKeys(primaryPath string, secondaryPaths ...string) (*SigningKeys, error)
ParseSigningKeys parses a list of signing keys separated by a comma and returns a list of GPG or SSH keys. Multiple signing keys are necessary to provide proper key rotation. The latest signing key is specified first and used for creating a signature. The previous signing keys go after and are used to verify a signature.
func (*SigningKeys) CreateSignature ¶ added in v16.4.0
func (s *SigningKeys) CreateSignature(contentToSign []byte) ([]byte, error)
CreateSignature uses the primary key to create a signature
func (*SigningKeys) Verify ¶ added in v16.4.0
func (s *SigningKeys) Verify(signature, signedText []byte) error
Verify iterates over all signing keys and returns nil if any verification was successful. Otherwise, the last error is returned. Note: when Golang 1.19 is no longer supported, can be refactored using errors.Join