-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathconstants.py
More file actions
41 lines (32 loc) · 822 Bytes
/
constants.py
File metadata and controls
41 lines (32 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import hashlib
class Algorithms(object):
NONE = 'none'
HS256 = 'HS256'
HS384 = 'HS384'
HS512 = 'HS512'
RS256 = 'RS256'
RS384 = 'RS384'
RS512 = 'RS512'
ES256 = 'ES256'
ES384 = 'ES384'
ES512 = 'ES512'
ES256K = 'ES256K'
HMAC = {HS256, HS384, HS512}
RSA = {RS256, RS384, RS512}
EC = {ES256, ES384, ES512, ES256K}
SUPPORTED = HMAC.union(RSA).union(EC)
ALL = SUPPORTED.union([NONE])
HASHES = {
HS256: hashlib.sha256,
HS384: hashlib.sha384,
HS512: hashlib.sha512,
RS256: hashlib.sha256,
RS384: hashlib.sha384,
RS512: hashlib.sha512,
ES256: hashlib.sha256,
ES384: hashlib.sha384,
ES512: hashlib.sha512,
ES256K: hashlib.sha256,
}
KEYS = {}
ALGORITHMS = Algorithms()