Spun Og

Greenhorn
+ Follow
since Sep 15, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Spun Og

Is it possible that its not trying to put it in the tmp folder ? Seeing as I only put the file name ? I dont understand why this would happen in only the production machine tho.
12 years ago
Hi,
Using tomcat 6 , struts 2.2.1.1 CENTOS
I have an app that generates pdf's and EXcel files. I have separate dev/test/staging production environments. I use CentOS for everything except the dev.
On the clients production machine I get a permissions error when creating the file. I assume its trying this in the tmp folder :



and then I send it to the stream like this :



So on the production machine I get this exception in the catalina.out :





AFter running getfacl I on the tmp folder I get this :




Please help......................

Spunog
12 years ago
Hi Greg,

Many thanks for your response.

I read my file as follows :


SecretKeySpec key = new SecretKeySpec(new String("mypassword").getBytes(), "Blowfish");
// Read the encrypted data
FileInputStream fis = new FileInputStream(logType);
byte[] buffer = new byte[(int)new File("data").length()];

byte[] temp = new byte[new Long( DATA_FILE.length()).intValue()];
int bytesRead = fis.read(temp);
byte[] data = new byte[bytesRead];
System.arraycopy(temp, 0, data, 0, bytesRead);

// Create the cipher for encrypting
Cipher cipher = Cipher.getInstance(CompetencyService.TOKEN);
cipher.init(Cipher.DECRYPT_MODE, key);

// Decrypt the data
byte[] decrypted = cipher.doFinal(data);
String[] params = convertByteArrayToString(decrypted).split(System.getProperty("line.separator"));



The only time I use the String.readBytes() is on the passkey. Is this what you mean ?

Thanks

Spunog
12 years ago
I am creating an encrypted license file with Java on a Linux machine. On the same linux machine I can use another program which has the same pass phrase to decrpyt this file. It works well.

If I copy that file onto a windows machine and run the same program, I get a BadPaddingException :



If I create the file on the windows machine, then I can decrypt it on the Windows machine. So it works well enough. Does anybody know whats going on here ? I am moving this app into production soon and I would like a better understanding of whats going on so I can deal with problems that might crop up.

Encryptino code :





Thanks in avance

Spunog
12 years ago