-
-
Save anonymous/11f1b20510f4205bec655230ce9c5608 to your computer and use it in GitHub Desktop.
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
*_���/�E��6�в�sqV?�<��k�Z] |
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
x | |
p�+*�ri{E(-�r�>�-ʲeЖ� �s- |
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
Aq�s����.n�~� |
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
import javax.crypto.Cipher; | |
import javax.crypto.spec.IvParameterSpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.io.*; | |
import java.nio.file.Files; | |
import javax.crypto.BadPaddingException; | |
import javax.crypto.IllegalBlockSizeException; | |
import javax.crypto.NoSuchPaddingException; | |
import java.security.InvalidAlgorithmParameterException; | |
import java.security.InvalidKeyException; | |
import java.security.NoSuchAlgorithmException; | |
public class Main { | |
public static void main(String[] args) throws IOException, InvalidAlgorithmParameterException, InvalidKeyException, NoSuchPaddingException, NoSuchAlgorithmException, BadPaddingException, IllegalBlockSizeException { | |
File AesKeyFile = new File("./Cipher2PHP/aes.key"); | |
File InitializationVectorFile = new File("./Cipher2PHP/initialization.vector"); | |
File EncryptedDataFile = new File("./Cipher2PHP/encrypted.data"); | |
byte[] AesKeyData = Files.readAllBytes(AesKeyFile.toPath()); | |
byte[] InitializationVectorData = Files.readAllBytes(InitializationVectorFile.toPath()); | |
byte[] EncryptedData = Files.readAllBytes(EncryptedDataFile.toPath()); | |
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); | |
SecretKeySpec keySpec = new SecretKeySpec(AesKeyData, "AES"); | |
cipher.init(Cipher.DECRYPT_MODE, keySpec, new IvParameterSpec(InitializationVectorData)); | |
byte[] result = cipher.doFinal(EncryptedData); | |
String decrypted = new String(result); | |
System.out.printf("Your data: %s\n", decrypted); | |
} | |
} |
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
<?php | |
$AesKeyData = file_get_contents('./Cipher2PHP/aes.key'); | |
$InitializationVectorData = file_get_contents('./Cipher2PHP/initialization.vector'); | |
$EncryptedData = file_get_contents('./Cipher2PHP/encrypted.data'); | |
$decrypted = openssl_decrypt( | |
$EncryptedData, | |
'AES-128-CBC', | |
$AesKeyData, | |
OPENSSL_NO_PADDING, | |
$InitializationVectorData | |
); | |
printf("Your data: %s\n", $decrypted); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment