Hi,
I want to generate secret key for encrypting a credit card number. But It provide a error as follow:
java.lang.NoClassDefFoundError

at javax.crypto.KeyGenerator.getInstance([DashoPro-V1.2-120198])
Could anyone tell me what this error is? 
any help I would highly appreciate.
Van Duong
 
My code:
import java.security.*;
import javax.crypto.*;
/**
 * This program demonstrates how to generate a secret-key object for
 * HMAC-MD5, and initialize an HMAC-MD5 object with it.
 */
public class initMac {
    public static void main(String[] args) throws Exception {
 // Install SunJCE provider
 Provider sunJce = new com.sun.crypto.provider.SunJCE();
 Security.addProvider(sunJce);
 // Generate secret key for HMAC-MD5
 KeyGenerator kg = KeyGenerator.getInstance("HmacMD5");
 SecretKey sk = kg.generateKey();
 // Get instance of Mac object implementing HMAC-MD5, and 
 // initialize it with the above secret key
 Mac mac = Mac.getInstance("HmacMD5");
 mac.init(sk);
 byte[] result = mac.doFinal("Hi There".getBytes());
    }
}
 

 
-----Original Message-----
From: Dean Parker [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 11, 2001 12:34 PM
To: Orion-Interest
Subject: RE: javax.crypto

That consists of 4 jars known collectively as  JCE (Java Cryptography Extension). The current version is 1.2.1.
 
jce1_2_1.jar
local_policy.jar
sunjce_provider.jar
US_export_policy.jar
 
jce1_2_1.jar is the actual API. sunjce_provider.jar is Suns' implementation of their API. It contains the actual algorithms and code that does all the work. Offhand, I don't know of any other 3rd parties that have implemented the API.
 
These files must be downloaded from Sun's website at this URL..
 
http://www.java.sun.com/products/jce/index.html
 
DP
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Van Duong
Sent: Wednesday, April 11, 2001 3:40 AM
To: Orion-Interest
Subject: javax.crypto

Hi,
 
Does anyone can tell me where the package javax.crypto is? 
 
Thanks in advance,
 
Van Duong 

Reply via email to