import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.GeneralSecurityException;
import java.security.Key;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
public class CipherUtil {
/**
* 使用AES对文件进行加密和解密
*
*/
private static String type = "AES";
/**
* 把文件srcFile加密后存储为destFile
* @param srcFile 加密前的文件
* @param destFile 加密后的文件
* @param privateKey 密钥
* @throws GeneralSecurityException
* @throws IOException
*/
public void encrypt(String srcFile, String destFile, String privateKey) throws GeneralSecurityException, IOException {
Key key = ge
aes加密文件
最新推荐文章于 2024-05-30 11:35:36 发布
![](https://img-home.csdnimg.cn/images/20240611030827.png)