开发者

this program is compiling perfectly but at runtime a problem with a class which is imported

I am using light weight bouncy castle package and this is my code

X9ECParameters x9=NISTNamedCurves.getByName开发者_JS百科("p-224");
ECDomainParameters params=new ECDomainParameters(x9.getCurve(),x9.getG(),x9.getN(),x9.getH());
ECKeyGenerationParameters gp=new ECKeyGeneratorParameters(params,SecureRandom.getInstance("SHA1PRNG"));
......

This program compiles successfully but generates run time error ..

java.lang.NOClassDefFoundError:java/security/SecureRandom

....

How can i solve it?


SecureRandom has been part of the Java standard API since Java 1.1, so what are you trying to run the code on? Google App Engine? Android? Java ME? Those are all environments that don't support the full Java Standard API library.

You'll have to investigate whether your platform offers a different source of high-quality randomness.


You probably should be using the J2ME version of the BC package. It includes it's own version of java.security.SecureRandom as well as other needed classes that are not in the J2ME. It is right there on the latest releases page, just search for lcrypto-j2me to find it on the page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜