小编s.s*_*ash的帖子

Java 解密创建附加符号

我写的加解密代码如下

import java.io.*;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.BadPaddingException;
import java.nio.file.Files;
import java.util.Scanner;

public class EncryptFile
{
    public static void main(String args[]) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException {
//Encrypt Mode
        FileOutputStream outputStream = new FileOutputStream(new File("D:\\encryptedNewStringFile.txt"));
        Key secretKey = new SecretKeySpec("encKey".getBytes(), "Blowfish");
        Cipher cipher = Cipher.getInstance("Blowfish");
        cipher.init(Cipher.ENCRYPT_MODE, secretKey);
        byte[] getFileBytes = "writing a file using encryption ".getBytes();
        byte[] outputBytes = cipher.doFinal(getFileBytes);
        outputStream.write(outputBytes);
        getFileBytes …
Run Code Online (Sandbox Code Playgroud)

java encryption blowfish

1
推荐指数
1
解决办法
95
查看次数

标签 统计

blowfish ×1

encryption ×1

java ×1