crypto

package
v0.0.0-...-d36ff20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(name string, secret tink.AEAD, key *tinkpb.KeyTemplate) error

func Open

func Open(root string) (*Aes, *HMac, *Jwt, error)

func RandomBytes

func RandomBytes(len int) []byte

func Restore

func Restore(name string, secret tink.AEAD) (*keyset.Handle, error)

Types

type Aes

type Aes struct {
	// contains filtered or unexported fields
}

func NewAes

func NewAes(file string, secret tink.AEAD) (*Aes, error)

func (*Aes) Decrypt

func (p *Aes) Decrypt(code []byte, salt []byte) ([]byte, error)

func (*Aes) Encrypt

func (p *Aes) Encrypt(plain []byte) ([]byte, []byte, error)

type HMac

type HMac struct {
	// contains filtered or unexported fields
}

func NewHMac

func NewHMac(file string, secret tink.AEAD) (*HMac, error)

func (*HMac) Sign

func (p *HMac) Sign(plain []byte) ([]byte, []byte, error)

func (*HMac) Verify

func (p *HMac) Verify(code []byte, plain []byte, salt []byte) error

type Jwt

type Jwt struct {
	// contains filtered or unexported fields
}

func NewJwt

func NewJwt(file string, secret tink.AEAD) (*Jwt, error)

func (*Jwt) Sign

func (p *Jwt) Sign(issuer string, subject string, audiences []string, claims map[string]interface{}, not_before *time.Time, expires_at *time.Time) (string, error)

func (*Jwt) Verify

func (p *Jwt) Verify(token string, issuer string, audience string) (string, string, map[string]interface{}, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL