Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java decrypt CryptoJS

String secret = "René Über";
String cipherText = "U2FsdGVkX1+tsmZvCEFa/iGeSA0K7gvgs9KXeZKwbCDNCs2zPo+BXjvKYLrJutMK+hxTwl/hyaQLOaD7LLIRo2I5fyeRMPnroo6k8N9uwKk=";

byte[] cipherData = Base64.getDecoder().decode(cipherText);
byte[] saltData = Arrays.copyOfRange(cipherData, 8, 16);

MessageDigest md5 = MessageDigest.getInstance("MD5");
final byte[][] keyAndIV = GenerateKeyAndIV(32, 16, 1, saltData, secret.getBytes(StandardCharsets.UTF_8), md5);
SecretKeySpec key = new SecretKeySpec(keyAndIV[0], "AES");
IvParameterSpec iv = new IvParameterSpec(keyAndIV[1]);

byte[] encrypted = Arrays.copyOfRange(cipherData, 16, cipherData.length);
Cipher aesCBC = Cipher.getInstance("AES/CBC/PKCS5Padding");
aesCBC.init(Cipher.DECRYPT_MODE, key, iv);
byte[] decryptedData = aesCBC.doFinal(encrypted);
String decryptedText = new String(decryptedData, StandardCharsets.UTF_8);

System.out.println(decryptedText);
Comment

PREVIOUS NEXT
Code Example
Java :: 1 2 1 3 2 1 4 3 2 1 3 2 1 2 1 1 java 
Java :: java optional input for funktions 
Java :: java.lang.NullPointerException at org.openqa.selenium.support.pagefactory.findElement(DefaultElementLocator.java:69) 
Java :: java Prefix Sum of Matrix (Or 2D Array) 
Java :: spring mvc aop transaction management 
Java :: Android equivalent of getElementById 
Java :: Which one of the following values can a Java variable NOT have? 
Java :: how to array list with a delimiter into text file java 
Java :: Spring AOP 
Java :: minecraft java plugin shift 
Java :: system.out.println(h [2] [1] [1] [0]); 
Java :: ConnectionString connection timeOut mongodb java 
Java :: ChangeElementsOfHashMap 
Java :: Armstrong Numbers Between Two Integers 
Java :: java logger errorAdd Answer 
Java :: if (copy = 5) { in java 
Java :: Java Enable assertion in class names 
Java :: integer class in java 
Java :: Java object of the file 
Java :: /= java 
Java :: date to timestamp java 
Java :: java.lang.stringindexoutofboundsexception: string index out of range: 10 
Java :: junit maven dependency 
Java :: Calling A Class From Another Class In Java 
Java :: import class from package java 
Java :: java read all text from file 
Java :: java game development course free 
Java :: nitrite get repo structure 
Sql :: select not matching data with join table 
Sql :: django.core.exceptions.ImproperlyConfigured: mysqlclient 1.4.0 or newer is required; you have 0.10.1. 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =