Documentation ¶
Index ¶
- func HmacSha256(ctx context.Context, data []byte, cipher wrapping.Wrapper, ...) (string, error)
- func HmacSha256WithPrk(ctx context.Context, data, prk []byte, opt ...wrapping.Option) (string, error)
- func NewDerivedReader(ctx context.Context, wrapper wrapping.Wrapper, lenLimit int64, ...) (*io.LimitedReader, error)
- func TestHmacSha256(t *testing.T, key, data []byte, opt ...wrapping.Option) string
- func TestWithBlake2b(t *testing.T, data []byte, w wrapping.Wrapper, opt ...wrapping.Option) string
- func TestWithEd25519(t *testing.T, data []byte, w wrapping.Wrapper, opt ...wrapping.Option) string
- func WithBase58Encoding() wrapping.Option
- func WithBase64Encoding() wrapping.Option
- func WithEd25519() wrapping.Option
- func WithInfo(info []byte) wrapping.Option
- func WithPrefix(prefix string) wrapping.Option
- func WithPrk(prk []byte) wrapping.Option
- func WithSalt(salt []byte) wrapping.Option
- type OptionFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HmacSha256 ¶
func HmacSha256(ctx context.Context, data []byte, cipher wrapping.Wrapper, opt ...wrapping.Option) (string, error)
HmacSha256 the provided data. Supports WithSalt, WithInfo, WithPrefix, WithEd25519 and WithPrk options. WithEd25519 is a "legacy" way to complete this operation and should not be used in new operations unless backward compatibility is needed. The WithPrefix option will prepend the prefix to the hmac-sha256 value.
func HmacSha256WithPrk ¶
func HmacSha256WithPrk(ctx context.Context, data, prk []byte, opt ...wrapping.Option) (string, error)
HmacSha256WithPrk will HmacSha256 using the provided prk. See HmacSha256 for options supported.
func NewDerivedReader ¶
func NewDerivedReader(ctx context.Context, wrapper wrapping.Wrapper, lenLimit int64, opt ...wrapping.Option) (*io.LimitedReader, error)
DerivedReader returns a reader from which keys can be read, using the given wrapper, reader length limit, salt and context info. Salt and info can be nil.
Example:
reader, _ := crypto.NewDerivedReader(wrapper, userId, jobId) key := ed25519.GenerateKey(reader)
func TestHmacSha256 ¶
TestHmacSha256 produces a test hmac sha256
func TestWithBlake2b ¶
TestWithBlake2b produces a test hmac sha256 using derived blake2b. Supported options: WithPrk
func TestWithEd25519 ¶
TestWithEd25519 produces test hmac sha256 using a derived Ed25519 key
func WithBase58Encoding ¶
WithBase58Encoding allows an optional request to base58 encode the data returned
func WithBase64Encoding ¶
WithBase64Encoding allows an optional request to base64 encode the data returned
func WithEd25519 ¶
WithEd25519 allows an optional request to use ed25519 during the operation
func WithPrefix ¶
WithPrefix allows an optional prefix to be specified for the data returned
Types ¶
type OptionFunc ¶
type OptionFunc func(*options) error
OptionFunc holds a function with local options