Leider schon wieder ein Problem:
Folgendes, hier erst mal der Code:
Ausgabe:
Das wird anders
FEHLER:
Wo ist das letzte Wort. Warum schneidet er das weg??
Hoffentlich wisst ihr es.
danke.
Folgendes, hier erst mal der Code:
Code:
Cipher c = Cipher.getInstance( "DES" );
Key k = new SecretKeySpec( "01234567".getBytes(), "DES" );
c.init( Cipher.ENCRYPT_MODE, k );
OutputStream out = new FileOutputStream( "C:/t.des" );
CipherOutputStream cos = new CipherOutputStream( out, c );
cos.write( "Das wird anders werden".getBytes() );
cos.close();
Cipher c1 = Cipher.getInstance("DES");
Key k1 = new SecretKeySpec( "01234567".getBytes(), "DES" );
c1.init(Cipher.DECRYPT_MODE, k1);
InputStream in = new FileInputStream( "C:/t.des" );
CipherInputStream cis = new CipherInputStream( in, c1 );
int len;
byte[] buf = new byte[100];
cis.read(buf);
for(int i = 0; i < buf.length; i++){
System.out.print((char)buf[i]);
}
cis.close();
Ausgabe:
Das wird anders
FEHLER:
Wo ist das letzte Wort. Warum schneidet er das weg??
Hoffentlich wisst ihr es.
danke.