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();

}

}

[2797 byte] By [fridia] at [2007-11-26 19:25:20]
# 1

There's nothing in your program that would cause a request to a DNS server - unless your JVM has been configured to send log output to a networked file-system. Or the directory in which you're executing the program is from a networked file-server, in which case the reading/writing of the input/output files must be resolved to another host.

Try the program on a non-networked PC and see what happens.

arshad.noora at 2007-7-9 21:49:17 > top of Java-index,Security,Cryptography...
# 2

Hm,

the program and the files to encrypt / decrypt are on local drives only.

I have tested several JVMs that I have on my machine. Some of them are "normally" installed, some of them are just copied into a sub dir "jre" of my program and startet by jre/bin/java.exe. There is no "non-local" logging.

And I have tested on different machines, even non-networked ones with all the same results. The destinations IP adresses is all that differs from one jre to another.

fridia at 2007-7-9 21:49:17 > top of Java-index,Security,Cryptography...
# 3

What version of Windows are you using, and what kind of security-related software are you running on the PC? Have you tried executing your code on a Linux/UNIX machine? It is highly unlikely that you'll see the problem on that platform - but if you do, there are tools where you can trace the execution of the JVM and filter it for name-service API calls to see where it is being initiated from.

I would still bet that some software on your PC is causing the outbound call.

arshad.noora at 2007-7-9 21:49:17 > top of Java-index,Security,Cryptography...
# 4
Cannot reproduce. Windows XP Pro SP2.
ejpa at 2007-7-9 21:49:17 > top of Java-index,Security,Cryptography...