...
1 package keygen
2
3 import (
4 "crypto/ecdsa"
5
6 "github.com/lestrrat-go/jwx/jwa"
7 "github.com/lestrrat-go/jwx/x25519"
8 )
9
10 type Generator interface {
11 Size() int
12 Generate() (ByteSource, error)
13 }
14
15
16 type Static []byte
17
18
19 type Random struct {
20 keysize int
21 }
22
23
24 type Ecdhes struct {
25 pubkey *ecdsa.PublicKey
26 keysize int
27 algorithm jwa.KeyEncryptionAlgorithm
28 enc jwa.ContentEncryptionAlgorithm
29 }
30
31
32 type X25519 struct {
33 algorithm jwa.KeyEncryptionAlgorithm
34 enc jwa.ContentEncryptionAlgorithm
35 keysize int
36 pubkey x25519.PublicKey
37 }
38
39
40
41
42 type ByteKey []byte
43
44
45
46
47 type ByteWithECPublicKey struct {
48 ByteKey
49 PublicKey interface{}
50 }
51
52 type ByteWithIVAndTag struct {
53 ByteKey
54 IV []byte
55 Tag []byte
56 }
57
58 type ByteWithSaltAndCount struct {
59 ByteKey
60 Salt []byte
61 Count int
62 }
63
64
65
66
67 type ByteSource interface {
68 Bytes() []byte
69 }
70
71 type Setter interface {
72 Set(string, interface{}) error
73 }
74
View as plain text