|
4 | 4 | * The classification into strong and weak are based on Wikipedia, OWASP and google (2017). |
5 | 5 | */ |
6 | 6 |
|
7 | | -/** |
8 | | - * Names of cryptographic algorithms, separated into strong and weak variants. |
9 | | - * |
10 | | - * The names are normalized: upper-case, no spaces, dashes or underscores. |
11 | | - * |
12 | | - * The names are inspired by the names used in real world crypto libraries. |
13 | | - * |
14 | | - * The classification into strong and weak are based on Wikipedia, OWASP and google (2017). |
15 | | - */ |
16 | | -module AlgorithmNames { |
17 | | - /** |
18 | | - * Holds if `name` corresponds to a strong hashing algorithm. |
19 | | - */ |
20 | | - predicate isStrongHashingAlgorithm(string name) { |
21 | | - name = |
22 | | - [ |
23 | | - "DSA", "ED25519", "ES256", "ECDSA256", "ES384", "ECDSA384", "ES512", "ECDSA512", "SHA2", |
24 | | - "SHA224", "SHA256", "SHA384", "SHA512", "SHA3", "SHA3224", "SHA3256", "SHA3384", "SHA3512" |
25 | | - ] |
26 | | - } |
27 | | - |
28 | | - /** |
29 | | - * Holds if `name` corresponds to a weak hashing algorithm. |
30 | | - */ |
31 | | - predicate isWeakHashingAlgorithm(string name) { |
32 | | - name = |
33 | | - [ |
34 | | - "HAVEL128", "MD2", "MD4", "MD5", "PANAMA", "RIPEMD", "RIPEMD128", "RIPEMD256", "RIPEMD160", |
35 | | - "RIPEMD320", "SHA0", "SHA1" |
36 | | - ] |
37 | | - } |
38 | | - |
39 | | - /** |
40 | | - * Holds if `name` corresponds to a strong encryption algorithm. |
41 | | - */ |
42 | | - predicate isStrongEncryptionAlgorithm(string name) { |
43 | | - name = |
44 | | - [ |
45 | | - "AES", "AES128", "AES192", "AES256", "AES512", "AES-128", "AES-192", "AES-256", "AES-512", |
46 | | - "ARIA", "BLOWFISH", "BF", "ECIES", "CAST", "CAST5", "CAMELLIA", "CAMELLIA128", |
47 | | - "CAMELLIA192", "CAMELLIA256", "CAMELLIA-128", "CAMELLIA-192", "CAMELLIA-256", "CHACHA", |
48 | | - "GOST", "GOST89", "IDEA", "RABBIT", "RSA", "SEED", "SM4" |
49 | | - ] |
50 | | - } |
51 | | - |
52 | | - /** |
53 | | - * Holds if `name` corresponds to a weak encryption algorithm. |
54 | | - */ |
55 | | - predicate isWeakEncryptionAlgorithm(string name) { |
56 | | - name = |
57 | | - [ |
58 | | - "DES", "3DES", "DES3", "TRIPLEDES", "DESX", "TDEA", "TRIPLEDEA", "ARC2", "RC2", "ARC4", |
59 | | - "RC4", "ARCFOUR", "ARC5", "RC5" |
60 | | - ] |
61 | | - } |
62 | | - |
63 | | - /** |
64 | | - * Holds if `name` corresponds to a strong password hashing algorithm. |
65 | | - */ |
66 | | - predicate isStrongPasswordHashingAlgorithm(string name) { |
67 | | - name = ["ARGON2", "PBKDF2", "BCRYPT", "SCRYPT"] |
68 | | - } |
69 | | - |
70 | | - /** |
71 | | - * Holds if `name` corresponds to a weak password hashing algorithm. |
72 | | - */ |
73 | | - predicate isWeakPasswordHashingAlgorithm(string name) { name = "EVPKDF" } |
74 | | - |
75 | | - /** |
76 | | - * Holds if `name` corresponds to a weak block cipher mode of operation. |
77 | | - */ |
78 | | - predicate isWeakBlockMode(string name) { name = "ECB" } |
79 | | -} |
80 | | - |
81 | | -private import AlgorithmNames |
| 7 | +private import internal.CryptoAlgorithmNames |
82 | 8 |
|
83 | 9 | /** |
84 | 10 | * A cryptographic algorithm. |
|
0 commit comments