...

Package cipher

import "github.com/lestrrat-go/jwx/jwe/internal/cipher"
Overview
Index

Overview ▾

Constants

const (
    TagSize = 16
)

type AesContentCipher

AesContentCipher represents a cipher based on AES

type AesContentCipher struct {
    NonceGenerator keygen.Generator
    // contains filtered or unexported fields
}

func NewAES

func NewAES(alg jwa.ContentEncryptionAlgorithm) (*AesContentCipher, error)

func (AesContentCipher) Decrypt

func (c AesContentCipher) Decrypt(cek, iv, ciphertxt, tag, aad []byte) (plaintext []byte, err error)

func (AesContentCipher) Encrypt

func (c AesContentCipher) Encrypt(cek, plaintext, aad []byte) (iv, ciphertext, tag []byte, err error)

func (AesContentCipher) KeySize

func (c AesContentCipher) KeySize() int

func (AesContentCipher) TagSize

func (c AesContentCipher) TagSize() int

type ContentCipher

ContentCipher knows how to encrypt/decrypt the content given a content encryption key and other data

type ContentCipher interface {
    KeySize() int
    Encrypt(cek, aad, plaintext []byte) ([]byte, []byte, []byte, error)
    Decrypt(cek, iv, aad, ciphertext, tag []byte) ([]byte, error)
}

type Fetcher

type Fetcher interface {
    Fetch([]byte) (cipher.AEAD, error)
}