Created
July 5, 2022 13:57
-
-
Save rbonifacio/d5d88e833fecfc9ace8360dda68d847a to your computer and use it in GitHub Desktop.
Code based on a CryptoAnalys test case. CogniCrypt still raises a warning.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String args[]) throws Exception { | |
KeyGenerator keyGenerator0 = KeyGenerator.getInstance("AES"); | |
SecretKey secretKey = keyGenerator0.generateKey(); | |
int num = 2024; | |
SecureRandom secureRandom0 = SecureRandom.getInstance("SHA1PRNG"); | |
byte[] genSeed = secureRandom0.generateSeed(num); | |
GCMParameterSpec gCMParameterSpec0 = new GCMParameterSpec(96, genSeed); | |
byte[] plainText = "secret".getBytes(); | |
Cipher cipher0 = Cipher.getInstance("AES/GCM/NoPadding"); | |
cipher0.init(1, secretKey, gCMParameterSpec0); | |
byte[] cipherText = cipher0.doFinal(plainText); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment