📄 des_decrypt.java.bak
字号:
import java.io.*;
import javax.crypto.*;
import java.security.*;
import javax.crypto.spec.*;
public class DES_decrypt
{
public static void main(String arg[]) throws Exception
{
System.out.println("Decrypt the \"ctext.dat\" to \"ptext2.dat\".");
FileInputStream f=new FileInputStream("SEncCBC.dat");
byte[] rand=new byte[8];
f.read(rand);
IvParameterSpec iv=new IvParameterSpec(rand);
FileInputStream f2=new FileInputStream("key1.dat");
ObjectInputStream ob=new ObjectInputStream(f2);
Key k=(Key)ob.readObject( );
Cipher cp=Cipher.getInstance("DESede/CBC/PKCS5Padding");
cp.init(Cipher.DECRYPT_MODE, k, iv);
FileInputStream fin=new FileInputStream("ctext.dat");
CipherInputStream cin=new CipherInputStream(fin, cp);
FileOutputStream fout=new FileOutputStream("ptext2.dat");
int b=0;
while( (b=cin.read())!=-1)
{
fout.write(b);
System.out.print((char)b);
}
System.out.println();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -