...
1 package keyenc
2
3 import (
4 "crypto/rsa"
5 "hash"
6
7 "github.com/lestrrat-go/jwx/jwa"
8 "github.com/lestrrat-go/jwx/jwe/internal/keygen"
9 )
10
11
12 type Encrypter interface {
13 Algorithm() jwa.KeyEncryptionAlgorithm
14 Encrypt([]byte) (keygen.ByteSource, error)
15
16
17
18 KeyID() string
19
20 SetKeyID(string)
21 }
22
23
24 type Decrypter interface {
25 Algorithm() jwa.KeyEncryptionAlgorithm
26 Decrypt([]byte) ([]byte, error)
27 }
28
29 type Noop struct {
30 alg jwa.KeyEncryptionAlgorithm
31 keyID string
32 sharedkey []byte
33 }
34
35
36
37 type AES struct {
38 alg jwa.KeyEncryptionAlgorithm
39 keyID string
40 sharedkey []byte
41 }
42
43
44 type AESGCMEncrypt struct {
45 algorithm jwa.KeyEncryptionAlgorithm
46 keyID string
47 sharedkey []byte
48 }
49
50
51 type ECDHESEncrypt struct {
52 algorithm jwa.KeyEncryptionAlgorithm
53 keyID string
54 generator keygen.Generator
55 }
56
57
58 type ECDHESDecrypt struct {
59 keyalg jwa.KeyEncryptionAlgorithm
60 contentalg jwa.ContentEncryptionAlgorithm
61 apu []byte
62 apv []byte
63 privkey interface{}
64 pubkey interface{}
65 }
66
67
68 type RSAOAEPEncrypt struct {
69 alg jwa.KeyEncryptionAlgorithm
70 pubkey *rsa.PublicKey
71 keyID string
72 }
73
74
75 type RSAOAEPDecrypt struct {
76 alg jwa.KeyEncryptionAlgorithm
77 privkey *rsa.PrivateKey
78 }
79
80
81 type RSAPKCS15Decrypt struct {
82 alg jwa.KeyEncryptionAlgorithm
83 privkey *rsa.PrivateKey
84 generator keygen.Generator
85 }
86
87
88 type RSAPKCSEncrypt struct {
89 alg jwa.KeyEncryptionAlgorithm
90 pubkey *rsa.PublicKey
91 keyID string
92 }
93
94
95 type DirectDecrypt struct {
96 Key []byte
97 }
98
99
100 type PBES2Encrypt struct {
101 algorithm jwa.KeyEncryptionAlgorithm
102 hashFunc func() hash.Hash
103 keylen int
104 keyID string
105 password []byte
106 }
107
View as plain text