keygen

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteKey

type ByteKey []byte

ByteKey is a generated key that only has the key's byte buffer as its instance data. If a ke needs to do more, such as providing values to be set in a JWE header, that key type wraps a ByteKey

func (ByteKey) Bytes

func (k ByteKey) Bytes() []byte

Bytes returns the byte from this ByteKey

type ByteSource

type ByteSource interface {
	Bytes() []byte
}

ByteSource is an interface for things that return a byte sequence. This is used for KeyGenerator so that the result of computations can carry more than just the generate byte sequence.

type ByteWithECPrivateKey

type ByteWithECPrivateKey struct {
	ByteKey
	PrivateKey *ecdsa.PrivateKey
}

ByteWithECPrivateKey holds the EC-DSA private key that generated the key along with the key itself. This is required to set the proper values in the JWE headers

func (ByteWithECPrivateKey) Populate

func (k ByteWithECPrivateKey) Populate(h Setter) error

HeaderPopulate populates the header with the required EC-DSA public key information ('epk' key)

type Ecdhes

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

EcdhesKeyGenerate generates keys using ECDH-ES algorithm

func NewEcdhes

func NewEcdhes(alg jwa.KeyEncryptionAlgorithm, pubkey *ecdsa.PublicKey) (*Ecdhes, error)

NewEcdhes creates a new key generator using ECDH-ES

func (Ecdhes) Generate

func (g Ecdhes) Generate() (ByteSource, error)

Generate generates new keys using ECDH-ES

func (Ecdhes) Size

func (g Ecdhes) Size() int

Size returns the key size associated with this generator

type Generator

type Generator interface {
	Size() int
	Generate() (ByteSource, error)
}

type Random

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

RandomKeyGenerate generates random keys

func NewRandom

func NewRandom(n int) Random

NewRandom creates a new Generator that returns random bytes

func (Random) Generate

func (g Random) Generate() (ByteSource, error)

Generate generates a random new key

func (Random) Size

func (g Random) Size() int

Size returns the key size

type Setter

type Setter interface {
	Set(string, interface{}) error
}

type Static

type Static []byte

StaticKeyGenerate uses a static byte buffer to provide keys.

func (Static) Generate

func (g Static) Generate() (ByteSource, error)

Generate returns the key

func (Static) Size

func (g Static) Size() int

Size returns the size of the key

Jump to

Keyboard shortcuts

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