Hello All,<BR>I have tried to make use of the Java example in Sun&#039s tutorial<BR>which is about security.The class GenSig is to generate a signature for a file,which is an argument when running in DOS prompt: <BR><BR>java GenSig filename<BR><BR>It works fine there,so I try to adapt it in ASP,using the<BR>getObject("java:GenSig") command.I changed the java program <BR>a bit at the same time in order to input the filename as a parameter of a public fucntion instead of the program argument.<BR><BR>However,when I run the program,there is such error message:<BR>java.lang.NoClassDefFoundError: java/security/SecureRandom.<BR>Why will this happen?Please give me a hand!<BR><BR>Thank you very much!<BR><BR>This is the ASP:<BR>&#060;%<BR>set f = getObject( "java:GenSig" )<BR>f.gen("c:javaAspjava.txt")<BR>%&#062;<BR><BR> Below is my code of JAVA :<BR>import java.io.*;<BR>import java.security.*;<BR><BR>public class GenSig {<BR><BR> public GenSig(){}<BR><BR> public String gen(String para1) {<BR><BR> /* Generate a DSA signature */<BR><BR> try{<BR><BR> /* Generate a key pair */<BR><BR> KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA", "SUN");<BR> SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");<BR><BR> keyGen.initialize(1024, random);<BR> KeyPair pair = keyGen.generateKeyPair();<BR> PrivateKey priv = pair.getPrivate();<BR> PublicKey pub = pair.getPublic();<BR><BR><BR> /* Create a Signature object and initialize it with the private key */<BR><BR> Signature dsa = Signature.getInstance("SHA1withDSA", "SUN"); <BR><BR> dsa.initSign(priv);<BR><BR> /* Update and sign the data */<BR><BR> FileInputStream fis = new FileInputStream(para1);<BR> BufferedInputStream bufin = new BufferedInputStream(fis);<BR> byte[] buffer = new byte[1024];<BR> int len;<BR> while (bufin.available() != 0) {<BR> len = bufin.read(buffer);<BR> dsa.update(buffer, 0, len);<BR> };<BR><BR> bufin.close();<BR><BR> /* Now that all the data to be signed has been read in, <BR> generate a signature for it */<BR><BR> byte[] realSig = dsa.sign();<BR><BR> <BR> /* Save the signature in a file */<BR> FileOutputStream sigfos = new FileOutputStream("sig");<BR> sigfos.write(realSig);<BR><BR> sigfos.close();<BR><BR><BR> /* Save the public key in a file */<BR> byte[] key = pub.getEncoded();<BR> FileOutputStream keyfos = new FileOutputStream("suepk");<BR> keyfos.write(key);<BR><BR> keyfos.close();<BR><BR> <BR> } catch (Exception e) {<BR> System.err.println("Caught exception " + e.toString());<BR> }<BR> return "success";<BR> };<BR><BR>}<BR><BR>Thank you very much!!<BR><BR><BR><BR>