File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 1
1
package jwt
2
2
3
3
import (
4
+ "encoding/hex"
4
5
"errors"
5
6
"fmt"
6
7
"strconv"
93
94
// Encryption using the Galois Counter mode of operation with
94
95
// AES cipher symmetric-key cryptographic.
95
96
//
97
+ // It should be HEX-encoded string value.
98
+ //
96
99
// The value should be the AES key,
97
100
// either 16, 24, or 32 bytes to select
98
101
// AES-128, AES-192, or AES-256.
@@ -160,7 +163,11 @@ func (c KeysConfiguration) Load() (Keys, error) {
160
163
}
161
164
162
165
if entry .EncryptionKey != "" {
163
- encrypt , decrypt , err := GCM ([]byte (entry .EncryptionKey ), nil )
166
+ encryptionKey , err := hex .DecodeString (entry .EncryptionKey )
167
+ if err != nil {
168
+ return nil , fmt .Errorf ("jwt: load keys: decode encryption key (hex): %w" , err )
169
+ }
170
+ encrypt , decrypt , err := GCM ([]byte (encryptionKey ), nil )
164
171
if err != nil {
165
172
return nil , fmt .Errorf ("jwt: load keys: build encryption: %w" , err )
166
173
}
You can’t perform that action at this time.
0 commit comments