Skip to content

Commit

Permalink
Fixed Use of a cryptographic algorithm with insufficient key size
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-kumar committed Aug 26, 2023
1 parent 3345c7f commit cd5c7e8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class EncryptionTest {
@BeforeClass
public void createKeyPair() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024); // Medium security is fine
keyPairGenerator.initialize(2048); // Medium security is fine
keyPair = keyPairGenerator.generateKeyPair();

KeyGenerator keyGenerator = KeyGenerator.getInstance("DES");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private byte[] encrypt(KeyPair keyPair) throws NoSuchAlgorithmException, NoSuchP
private KeyPair generateKeyPair() throws NoSuchAlgorithmException, NoSuchProviderException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA");
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG", "SUN");
keyPairGenerator.initialize(1024, secureRandom);
keyPairGenerator.initialize(2048, secureRandom);

return keyPairGenerator.generateKeyPair();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class CertificateMock {
public static X509Certificate withCN(String cn) {
try {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA", "BC");
keyPairGenerator.initialize(1024, new SecureRandom()); // No ment to be secure!
keyPairGenerator.initialize(2048, new SecureRandom()); // No ment to be secure!

KeyPair keyPair = keyPairGenerator.generateKeyPair();

Expand Down

0 comments on commit cd5c7e8

Please sign in to comment.