import javax.crypto.*; import javax.crypto.spec.*; import java.io.*; public class DESKrypt2a{ public static void main(String argumendid[]) throws Exception{ byte[] votmebaidid=new byte[8]; for(int i=0; i<8; i++){ votmebaidid[i]=(byte)0xFF; } SecretKey voti=SecretKeyFactory.getInstance("DES").generateSecret( new DESKeySpec(votmebaidid) ); Cipher kodeerija=Cipher.getInstance("DES"); kodeerija.init(Cipher.DECRYPT_MODE, voti); CipherInputStream salasisendvoog=new CipherInputStream( new FileInputStream("DES2.dat"), kodeerija ); byte[] b =new byte[1000]; int pikkus=salasisendvoog.read(b); System.out.println(new String(b, 0, pikkus)); } }