hameeds
asked on
Triple DES encryption with MD5 hashkey
Anyone worked on this type of encryption. Please help.
The following parameters should be used as part of the encryption process.
Key Size : 164 bytes
Block Size : 128 bytes
Key : generated dynamically
I m getting the following error:
Key is suppose to be 164 bytes. but DESede key requires 24 bytes.
Not sure where is the error. Please help
Exception in thread "main" java.security.InvalidKeyEx ception: Wrong key size
at javax.crypto.spec.DESedeKe ySpec.<ini t>(DashoA1 2275)
at javax.crypto.spec.DESedeKe ySpec.<ini t>(DashoA1 2275)
(Edited by _alias99)
The following parameters should be used as part of the encryption process.
Key Size : 164 bytes
Block Size : 128 bytes
Key : generated dynamically
I m getting the following error:
Key is suppose to be 164 bytes. but DESede key requires 24 bytes.
Not sure where is the error. Please help
Exception in thread "main" java.security.InvalidKeyEx
at javax.crypto.spec.DESedeKe
at javax.crypto.spec.DESedeKe
(Edited by _alias99)
import org.apache.commons.codec.b
inary.*;
import java.security.spec.AlgorithmParameterSpec;
public class Multiply{
private long expireTimeInMilliseconds;
public static void main(String[] args) throws Exception {
String s = integerObj + "0";
integerObj = Integer.parseInt(s);
if(args.length != 2){
System.out.println("Usage: java Multiply <rows> <columns>");
System.exit(0);
}
int rows = 0, columns = 0;
try{
rows = Integer.parseInt(args[0]);
columns = Integer.parseInt(args[1]);
}catch(NumberFormatException e){
System.out.println("Wrong parameter(s)");
System.exit(0);
}
System.out.println("Multiplication Table ("+rows+" X "+columns+")");
for(int i = 1;i <= rows;i++){
System.out.print(i+"\t>");
for(int j = 1;j <= columns;j++)
System.out.print("\t"+(i*j));
System.out.println("");
}
public void setExpireTimeInDays(int expireTimeInDays)
{
expireTimeInMilliseconds = ((long) expireTimeInDays) * 24 * 60 * 60 * 1000;
}
ASKER
I think I have resolved a part of it. This is different issue. i get another issue with the above code.
Exception in thread "main" java.security.InvalidKeyEx ception: Wrong key size
at javax.crypto.spec.DESedeKe ySpec.<ini t>(DashoA1 2275)
at javax.crypto.spec.DESedeKe ySpec.<ini t>(DashoA1 2275)
at TripleDES.main(TripleDES.j ava:26)
Once I resolve completely, I will accept solution.
Exception in thread "main" java.security.InvalidKeyEx
at javax.crypto.spec.DESedeKe
at javax.crypto.spec.DESedeKe
at TripleDES.main(TripleDES.j
Once I resolve completely, I will accept solution.
As you solve parts of the picture you should really be closing the questions as you go along or things tend to get out of hand and can lead to a lack of focus.
Anyway, you should probably be looking into what that .NET code does with the MD5 hash and doing exactly the same
Anyway, you should probably be looking into what that .NET code does with the MD5 hash and doing exactly the same
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>why are you MD5'ing the password to make a key?
Err... because the native code is doing so?
Is that the case hameeds?
Err... because the native code is doing so?
Is that the case hameeds?
ASKER
Thank you for your support. I was recently in trouble for posting some Security Aglorithm which is sensitive and proprietary information. Please REPLACE the post code snippet with the following code snippet.
import org.apache.commons.codec.binary.*;
import java.security.spec.AlgorithmParameterSpec;
public class Multiply{
private long expireTimeInMilliseconds;
public static void main(String[] args) throws Exception {
String s = integerObj + "0";
integerObj = Integer.parseInt(s);
if(args.length != 2){
System.out.println("Usage: java Multiply <rows> <columns>");
System.exit(0);
}
int rows = 0, columns = 0;
try{
rows = Integer.parseInt(args[0]);
columns = Integer.parseInt(args[1]);
}catch(NumberFormatException e){
System.out.println("Wrong parameter(s)");
System.exit(0);
}
System.out.println("Multiplication Table ("+rows+" X "+columns+")");
for(int i = 1;i <= rows;i++){
System.out.print(i+"\t>");
for(int j = 1;j <= columns;j++)
System.out.print("\t"+(i*j));
System.out.println("");
}
public void setExpireTimeInDays(int expireTimeInDays)
{
expireTimeInMilliseconds = ((long) expireTimeInDays) * 24 * 60 * 60 * 1000;
}
16. You've another question open on this still?