MCPcopy Create free account
hub / github.com/bit4woo/ReSign / decrypt

Method decrypt

src/custom/CAESOperator.java:42–56  ·  view source on GitHub ↗
(String sSrc)

Source from the content-addressed store, hash-verified

40
41
42 public String decrypt(String sSrc) throws Exception {
43 try {
44 byte[] raw = sKey.getBytes("ASCII");
45 SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
46 Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
47 IvParameterSpec iv = new IvParameterSpec(ivParameter.getBytes());
48 cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
49 byte[] encrypted1 = CBase64.decode(sSrc, CBase64.DEFAULT);//先用base64解密
50 byte[] original = cipher.doFinal(encrypted1);
51 String originalString = new String(original,"utf-8");
52 return originalString;
53 } catch (Exception ex) {
54 return null;
55 }
56 }
57
58 public static void main(String[] args) throws Exception {
59 // 需要加密的字符串

Callers 1

mainMethod · 0.45

Calls 2

decodeMethod · 0.95
getInstanceMethod · 0.80

Tested by

no test coverage detected