@@ -16,9 +16,9 @@ <h2>Why is this an issue?</h2>
1616< p > Note that depending on the algorithm, the term < strong > key</ strong > refers to a different mathematical property. For example:</ p >
1717< ul >
1818 < li > For RSA, the key is the product of two large prime numbers, also called the < strong > modulus</ strong > . </ li >
19- < li > For AES and Elliptic Curve Cryptography (ECC), the key is only a sequence of randomly generated bytes.
19+ < li > For Elliptic Curve Cryptography (ECC), the key is only a sequence of randomly generated bytes.
2020 < ul >
21- < li > In some cases, AES keys are derived from a master key or a passphrase using a Key Derivation Function (KDF) like PBKDF2 (Password-Based Key
21+ < li > In some cases, keys are derived from a master key or a passphrase using a Key Derivation Function (KDF) like PBKDF2 (Password-Based Key
2222 Derivation Function 2) </ li >
2323 </ ul > </ li >
2424</ ul >
@@ -66,21 +66,6 @@ <h4>Noncompliant code example</h4>
6666 }
6767}
6868</ pre >
69- < p > Here is an example of a private key generation with AES:</ p >
70- < pre data-diff-id ="2 " data-diff-type ="noncompliant ">
71- import java.security.KeyGenerator;
72- import java.security.NoSuchAlgorithmException;
73-
74- public static void main(String[] args) {
75- try {
76- KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
77- keyGenerator.initialize(64); // Noncompliant
78-
79- } catch (NoSuchAlgorithmException e) {
80- // ...
81- }
82- }
83- </ pre >
8469< p > Here is an example of an Elliptic Curve (EC) initialization. It implicitly generates a private key whose size is indicated in the elliptic curve
8570name:</ p >
8671< pre data-diff-id ="3 " data-diff-type ="noncompliant ">
@@ -115,20 +100,6 @@ <h4>Compliant solution</h4>
115100 }
116101}
117102</ pre >
118- < pre data-diff-id ="2 " data-diff-type ="compliant ">
119- import java.security.KeyPairGenerator;
120- import java.security.NoSuchAlgorithmException;
121-
122- public static void main(String[] args) {
123- try {
124- KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("AES");
125- keyPairGenerator.initialize(128);
126-
127- } catch (NoSuchAlgorithmException e) {
128- // ...
129- }
130- }
131- </ pre >
132103< pre data-diff-id ="3 " data-diff-type ="compliant ">
133104import java.security.KeyPairGenerator;
134105import java.security.NoSuchAlgorithmException;
@@ -153,11 +124,6 @@ <h4>RSA (Rivest-Shamir-Adleman) and DSA (Digital Signature Algorithm)</h4>
153124< p > The security of these algorithms depends on the difficulty of attacks attempting to solve their underlying mathematical problem.</ p >
154125< p > In general, a minimum key size of < strong > 2048</ strong > bits is recommended for both. It provides 112 bits of security. A key length of
155126< strong > 3072</ strong > or < strong > 4096</ strong > should be preferred when possible.</ p >
156- < h4 > AES (Advanced Encryption Standard)</ h4 >
157- < p > AES supports three key sizes: 128 bits, 192 bits and 256 bits. The security of the AES algorithm is based on the computational complexity of trying
158- all possible keys.< br > A larger key size increases the number of possible keys and makes exhaustive search attacks computationally infeasible.
159- Therefore, a 256-bit key provides a higher level of security than a 128-bit or 192-bit key.</ p >
160- < p > Currently, a minimum key size of < strong > 128 bits</ strong > is recommended for AES.</ p >
161127< h4 > Elliptic Curve Cryptography (ECC)</ h4 >
162128< p > Elliptic curve cryptography is also used in various algorithms, such as ECDSA, ECDH, or ECMQV. The length of keys generated with elliptic curve
163129algorithms is mentioned directly in their names. For example, < code > secp256k1</ code > generates a 256-bits long private key.</ p >
0 commit comments