package ed25519
import "github.com/hashicorp/go-kms-wrapping/v2/ed25519"
Index ¶
- Constants
- func TestSigInfo(t *testing.T, privKey ed25519.PrivateKey, msg []byte, opt ...wrapping.Option) *wrapping.SigInfo
- func WithPrivKey(k ed25519.PrivateKey) wrapping.Option
- func WithPubKey(k ed25519.PublicKey) wrapping.Option
- type OptionFunc
- type Signer
- func NewSigner(ctx context.Context, opt ...wrapping.Option) (*Signer, error)
- func (s *Signer) KeyBytes(context.Context) ([]byte, error)
- func (s *Signer) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrapping.WrapperConfig, error)
- func (s *Signer) Sign(tx context.Context, msg []byte, _ ...wrapping.Option) (*wrapping.SigInfo, error)
- type Verifier
- func NewVerifier(ctx context.Context, opt ...wrapping.Option) (*Verifier, error)
- func (s *Verifier) KeyBytes(context.Context) ([]byte, error)
- func (s *Verifier) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrapping.WrapperConfig, error)
- func (s *Verifier) Verify(ctx context.Context, msg []byte, sig *wrapping.SigInfo, _ ...wrapping.Option) (bool, error)
Constants ¶
const ( ConfigPrivKey = "priv_key" ConfigPubKey = "pub_key" ConfigKeyId = "key_id" ConfigKeyPurposes = "key_purposes" )
Functions ¶
func TestSigInfo ¶
func TestSigInfo(t *testing.T, privKey ed25519.PrivateKey, msg []byte, opt ...wrapping.Option) *wrapping.SigInfo
TestSigInfo creates a test SigInfo using the provided ed25519 priv key
func WithPrivKey ¶
func WithPrivKey(k ed25519.PrivateKey) wrapping.Option
WithPrivKey provides a common way to pass in a private key. This local option will override a ConfigMap provide option.
func WithPubKey ¶
WithPubKey provides a common way to pass in a public key. This local option will override a ConfigMap provide option.
Types ¶
type OptionFunc ¶
type OptionFunc func(*options) error
OptionFunc holds a function with local options
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer provides an ed25519 implementation for the wrapping.Signer interface
func NewSigner ¶
NewSigner creates a new Signer. Supported options: WithKeyId, WithKeyPurposes, WithPrivKey, WithConfigMap
Note: options order of precedence is: local options, WithConfigMap provided options and finally wrapping options.
func (*Signer) KeyBytes ¶
KeyBytes returns the current key bytes
func (*Signer) SetConfig ¶
func (s *Signer) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrapping.WrapperConfig, error)
SetConfig sets the fields on the Signer
Supported options: wrapping.WithKeyId, wrapping.WithKeyPurposes, wrapping.WithConfigMap and the local WithPrivKey
Note: options order of precedence is: local options, WithConfigMap provided options and finally wrapping options.
wrapping.WithConfigMap supports a ConfigPrivKey to set the Signer priv key along with ConfigKeyId, and ConfigKeyPurposes. ConfigKeyPurposes are a comma delimited list of wrapping.KeyPurpose_name values (for example: "Sign, Verify")
The values in WithConfigMap can also be set via the package's native local options.
func (*Signer) Sign ¶
func (s *Signer) Sign(tx context.Context, msg []byte, _ ...wrapping.Option) (*wrapping.SigInfo, error)
Sign creates a signature of the provided msg. No options are currently supported.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier provides and ed25519 implementation for the wrapping.Verifier interface
func NewVerifier ¶
NewVerifier creates a new verifier. Supported options: WithKeyId, WithKeyPurposes, WithPubKey, WithConfigMap
Note: options order of precedence is: local options, WithConfigMap provided options and finally wrapping options.
func (*Verifier) KeyBytes ¶
KeyBytes returns the current key bytes
func (*Verifier) SetConfig ¶
func (s *Verifier) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrapping.WrapperConfig, error)
SetConfig sets the fields on the Verifier
Supported options: wrapping.WithKeyId, wrapping.WithKeyPurposes, wrapping.WithConfigMap and the local WithPubKey
Note: options order of precedence is: local options, WithConfigMap provided options and finally wrapping options.
wrapping.WithConfigMap supports a ConfigPubKey to set the Verifier pub key. along with ConfigKeyId, and ConfigKeyPurposes. ConfigKeyPurposes are a comma delimited list of wrapping.KeyPurpose_name values (for example: "Sign, Verify")
The values in WithConfigMap can also be set via the package's native local options.
func (*Verifier) Verify ¶
func (s *Verifier) Verify(ctx context.Context, msg []byte, sig *wrapping.SigInfo, _ ...wrapping.Option) (bool, error)
Verify will verify the signature of the provided msg. No options are currently supported.
Source Files ¶
options.go signer.go testing.go verifier.go
- Version
- v2.0.18 (latest)
- Published
- Jan 23, 2025
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 1 month ago –
Tools for package owners.