Firewall problem when encrypting/decryting a file
Hi,
I'm a little bit new to cryptography.
When I encrypt a file using the javax.crypto classes, my firewall pops up and says "java.exe is attempting to connect to a DNS Server".
If I block the firewall, nothing else happens and the file gets encrypted as well. But I don't want to insecure all my customers having this firewall alerts.
Can anyone help me to stop that ? Thanks in advance,
- fridi -
This is the example code I am using:
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.GeneralSecurityException;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
publicclass TestCrypt{
publicstaticvoid main(String[] args)throws Exception, GeneralSecurityException{
String inFilename = args[0];
String outFilename = args[1];
byte[] keyArray ="My one and only key blablabalbal".getBytes();
DESedeKeySpec desedeKeySpec =new DESedeKeySpec(keyArray);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
SecretKey key = keyFactory.generateSecret(desedeKeySpec);
Cipher cip = Cipher.getInstance("DESede");
cip.init(Cipher.ENCRYPT_MODE, key);
FileInputStream fis =new FileInputStream(inFilename);
CipherInputStream cis =new CipherInputStream(fis, cip);
FileOutputStream fos =new FileOutputStream(outFilename);
byte[] b =newbyte[1024];
int i = cis.read(b);
while (i != -1){
fos.write(b, 0, i);
i = cis.read(b);
}
fos.close();
cis.close();
}
}

