MCPcopy Create free account
hub / github.com/Drun1baby/JavaSecurityLearning / AESencode

Class AESencode

JavaSecurity/AesEncode.java:10–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10public class AESencode {
11 public static void main(String[] args) throws Exception {
12 String path = "/Users/xxxx/Desktop/java/ShiroTool/cc11";
13 byte[] key = Base64.decode("kPH+bIxk5D2deZiIxcaaaA==");
14 AesCipherService aes = new AesCipherService();
15 ByteSource ciphertext = aes.encrypt(getBytes(detectpath), key);
16 System.out.printf(ciphertext.toString());
17 }
18
19
20 public static byte[] getBytes(String path) throws Exception{
21 InputStream inputStream = new FileInputStream(path);
22 ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
23 int n = 0;
24 while ((n=inputStream.read())!=-1){
25 byteArrayOutputStream.write(n);
26 }
27 byte[] bytes = byteArrayOutputStream.toByteArray();
28 return bytes;
29
30 }
31}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected