package keygen
import "github.com/lestrrat-go/jwx/jwe/internal/keygen"
Index ¶
- type ByteKey
- type ByteSource
- type ByteWithECPublicKey
- type ByteWithIVAndTag
- type ByteWithSaltAndCount
- type Ecdhes
- func NewEcdhes(alg jwa.KeyEncryptionAlgorithm, enc jwa.ContentEncryptionAlgorithm, keysize int, pubkey *ecdsa.PublicKey) (*Ecdhes, error)
- func (g Ecdhes) Generate() (ByteSource, error)
- func (g Ecdhes) Size() int
- type Generator
- type Random
- func NewRandom(n int) Random
- func (g Random) Generate() (ByteSource, error)
- func (g Random) Size() int
- type Setter
- type Static
- type X25519
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 key needs to do more, such as providing values to be set in a JWE header, that key type wraps a ByteKey
func (ByteKey) Bytes ¶
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 ByteWithECPublicKey ¶
type ByteWithECPublicKey struct { ByteKey PublicKey interface{} }
ByteWithECPublicKey holds the EC private key that generated the key along with the key itself. This is required to set the proper values in the JWE headers
func (ByteWithECPublicKey) Populate ¶
func (k ByteWithECPublicKey) Populate(h Setter) error
HeaderPopulate populates the header with the required EC-DSA public key information ('epk' key)
type ByteWithIVAndTag ¶
func (ByteWithIVAndTag) Populate ¶
func (k ByteWithIVAndTag) Populate(h Setter) error
HeaderPopulate populates the header with the required AES GCM parameters ('iv' and 'tag')
type ByteWithSaltAndCount ¶
func (ByteWithSaltAndCount) Populate ¶
func (k ByteWithSaltAndCount) Populate(h Setter) error
HeaderPopulate populates the header with the required PBES2 parameters ('p2s' and 'p2c')
type Ecdhes ¶
type Ecdhes struct {
// contains filtered or unexported fields
}
EcdhesKeyGenerate generates keys using ECDH-ES algorithm / EC-DSA curve
func NewEcdhes ¶
func NewEcdhes(alg jwa.KeyEncryptionAlgorithm, enc jwa.ContentEncryptionAlgorithm, keysize int, 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 ¶
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 ¶
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 ¶
Size returns the key size
type Setter ¶
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 ¶
Size returns the size of the key
type X25519 ¶
type X25519 struct {
// contains filtered or unexported fields
}
X25519KeyGenerate generates keys using ECDH-ES algorithm / X25519 curve
func NewX25519 ¶
func NewX25519(alg jwa.KeyEncryptionAlgorithm, enc jwa.ContentEncryptionAlgorithm, keysize int, pubkey x25519.PublicKey) (*X25519, error)
NewX25519 creates a new key generator using ECDH-ES
func (X25519) Generate ¶
func (g X25519) Generate() (ByteSource, error)
Generate generates new keys using ECDH-ES
func (X25519) Size ¶
Size returns the key size associated with this generator
Source Files ¶
- Version
- v1.2.31 (latest)
- Published
- Apr 9, 2025
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 3 weeks ago –
Tools for package owners.