|
|
Welcome to the Java Forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
- have access to post topics
- communicate privately with other members (PM)
- not see advertisements between posts
- have the possibility to earn one of our surprises if you are an active member
- access many other special features that will be introduced later.
Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact us.
|
|

04-16-2008, 07:06 AM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 9
|
|
|
beginner to Java
I am a beginner with Java. I just installed the Bouncy Castle provider and would like to test some sample codes to see if everything is correctly installed. I downloaded a zip file that contains all of the example code. My question is: Can I run this code straight from a folder on the desktop or does it have to be placed in a certain place in order for it to compile? I thought I all I need is the provider to start using the library. Is this correct or do I need some extra files?
Thanks in advance.
|
|

04-16-2008, 10:59 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,376
|
|
|
First of all, welcome to Java Forums.
After downloading samples what you have done. Try to open a file and compile? If so any errors?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-16-2008, 06:42 PM
|
 |
Senior Member
|
|
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
|
|
Can I run this code straight from a folder on the desktop or does it have to be placed in a certain place in order for it to compile?
Yes, you can, if you already set the bin folder in the classpath...
or if none, you have to compile it in the jdk's bin folder where javac.exe exists.
regards,
sukatoa
|
|

04-17-2008, 03:30 AM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 9
|
|
Originally Posted by sukatoa
Yes, you can, if you already set the bin folder in the classpath...
or if none, you have to compile it in the jdk's bin folder where javac.exe exists.
regards,
sukatoa
I set the PATH (both User and System variables) as C:\Program Files\Java\jdk1.6.0_05\bin in the Environmental Variables. Is this what you mean? OR do I need to another variable containing the location of the BouncyCastle provider?
Thanks for your help!
EDIT:
I set the CLASSPATH variable in both User and System variables to:
.;C:\Program Files\Java\jre1.6.0_05\lib\ext; C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext;
but when I try compiling the code I'm getting the error. (cannot find symbol errors)
I followed all other rules yet it still will not compile.
Last edited by notwist : 04-17-2008 at 04:20 AM.
|
|

04-17-2008, 05:22 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,376
|
|
|
Can you put the complete compile error to see. Seems to me something wrong with your code. Are sure that your code is error free?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-17-2008, 05:34 AM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 9
|
|
I think the code is error free since it's some example code supplied with BC. I checked the code to make sure that the package structure is setup properly and all the imported classes are present. I think it might be something with the classpath although the directory in the classpath does contain the providers.
Here is the errors along with my classpath:
C:\org\bouncycastle\crypto\test>dir
Volume in drive C has no label.
Volume Serial Number is 004A-9ED9
Directory of C:\org\bouncycastle\crypto\test
04/16/2008 08:10 PM <DIR> .
04/16/2008 08:10 PM <DIR> ..
07/06/2005 11:02 PM 670 BigIntegerTest.java
12/30/2005 03:02 PM 1,575 CryptoRegressionTest.java
07/06/2005 11:02 PM 9,700 RSATest.java
04/16/2008 08:34 PM 1,865 RegressionTest.java
11/25/2006 02:51 PM 58,188 GOST3410Test.java
11/11/2006 07:46 PM 14,484 GOST28147Test.java
04/16/2008 08:39 PM 6,946 RSATest.class
7 File(s) 93,428 bytes
2 Dir(s) 1,807,384,576 bytes free
C:\org\bouncycastle\crypto\test>set CLASSPATH
CLASSPATH=.;C:\Program Files\Java\jre1.6.0_05\lib\ext; C:\Program Files\Java\jdk1.6.0_05\jre\lib\ext;
C:\org\bouncycastle\crypto\test>javac RegressionTest.java
RegressionTest.java:15: cannot find symbol
symbol : class AESTest
location: class org.bouncycastle.crypto.test.RegressionTest
new AESTest(),
^
RegressionTest.java:16: cannot find symbol
symbol : class DESTest
location: class org.bouncycastle.crypto.test.RegressionTest
new DESTest(),
^
RegressionTest.java:17: cannot find symbol
symbol : class DESedeTest
location: class org.bouncycastle.crypto.test.RegressionTest
new DESedeTest(),
^
RegressionTest.java:18: cannot find symbol
symbol : class ModeTest
location: class org.bouncycastle.crypto.test.RegressionTest
new ModeTest(),
^
RegressionTest.java:19: cannot find symbol
symbol : class DHTest
location: class org.bouncycastle.crypto.test.RegressionTest
new DHTest(),
^
RegressionTest.java:20: cannot find symbol
symbol : class ElGamalTest
location: class org.bouncycastle.crypto.test.RegressionTest
new ElGamalTest(),
^
RegressionTest.java:21: cannot find symbol
symbol : class DSATest
location: class org.bouncycastle.crypto.test.RegressionTest
new DSATest(),
^
RegressionTest.java:22: cannot find symbol
symbol : class ECTest
location: class org.bouncycastle.crypto.test.RegressionTest
new ECTest(),
^
RegressionTest.java:23: cannot find symbol
symbol : class ECIESTest
location: class org.bouncycastle.crypto.test.RegressionTest
new ECIESTest(),
^
RegressionTest.java:24: cannot find symbol
symbol : class MacTest
location: class org.bouncycastle.crypto.test.RegressionTest
new MacTest(),
^
RegressionTest.java:25: cannot find symbol
symbol : class RC2Test
location: class org.bouncycastle.crypto.test.RegressionTest
new RC2Test(),
^
RegressionTest.java:26: cannot find symbol
symbol : class RC4Test
location: class org.bouncycastle.crypto.test.RegressionTest
new RC4Test(),
^
RegressionTest.java:27: cannot find symbol
symbol : class RC5Test
location: class org.bouncycastle.crypto.test.RegressionTest
new RC5Test(),
^
RegressionTest.java:28: cannot find symbol
symbol : class RC6Test
location: class org.bouncycastle.crypto.test.RegressionTest
new RC6Test(),
^
RegressionTest.java:29: cannot find symbol
symbol : class RijndaelTest
location: class org.bouncycastle.crypto.test.RegressionTest
new RijndaelTest(),
^
RegressionTest.java:30: cannot find symbol
symbol : class SerpentTest
location: class org.bouncycastle.crypto.test.RegressionTest
new SerpentTest(),
^
RegressionTest.java:31: cannot find symbol
symbol : class SkipjackTest
location: class org.bouncycastle.crypto.test.RegressionTest
new SkipjackTest(),
^
RegressionTest.java:32: cannot find symbol
symbol : class BlowfishTest
location: class org.bouncycastle.crypto.test.RegressionTest
new BlowfishTest(),
^
RegressionTest.java:33: cannot find symbol
symbol : class TwofishTest
location: class org.bouncycastle.crypto.test.RegressionTest
new TwofishTest(),
^
RegressionTest.java:34: cannot find symbol
symbol : class CAST5Test
location: class org.bouncycastle.crypto.test.RegressionTest
new CAST5Test(),
^
RegressionTest.java:35: cannot find symbol
symbol : class CAST6Test
location: class org.bouncycastle.crypto.test.RegressionTest
new CAST6Test(),
^
RegressionTest.java:36: cannot find symbol
symbol : class IDEATest
location: class org.bouncycastle.crypto.test.RegressionTest
new IDEATest(),
^
RegressionTest.java:37: cannot find symbol
symbol : class CamelliaTest
location: class org.bouncycastle.crypto.test.RegressionTest
new CamelliaTest(),
^
RegressionTest.java:38: cannot find symbol
symbol : class RSATest
location: class org.bouncycastle.crypto.test.RegressionTest
new RSATest(),
^
RegressionTest.java:39: cannot find symbol
symbol : class ISO9796Test
location: class org.bouncycastle.crypto.test.RegressionTest
new ISO9796Test(),
^
RegressionTest.java:40: cannot find symbol
symbol : class MD2DigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new MD2DigestTest(),
^
RegressionTest.java:41: cannot find symbol
symbol : class MD4DigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new MD4DigestTest(),
^
RegressionTest.java:42: cannot find symbol
symbol : class MD5DigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new MD5DigestTest(),
^
RegressionTest.java:43: cannot find symbol
symbol : class SHA1DigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new SHA1DigestTest(),
^
RegressionTest.java:44: cannot find symbol
symbol : class SHA256DigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new SHA256DigestTest(),
^
RegressionTest.java:45: cannot find symbol
symbol : class SHA384DigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new SHA384DigestTest(),
^
RegressionTest.java:46: cannot find symbol
symbol : class SHA512DigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new SHA512DigestTest(),
^
RegressionTest.java:47: cannot find symbol
symbol : class RIPEMD128DigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new RIPEMD128DigestTest(),
^
RegressionTest.java:48: cannot find symbol
symbol : class RIPEMD160DigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new RIPEMD160DigestTest(),
^
RegressionTest.java:49: cannot find symbol
symbol : class TigerDigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new TigerDigestTest(),
^
RegressionTest.java:50: cannot find symbol
symbol : class MD5HMacTest
location: class org.bouncycastle.crypto.test.RegressionTest
new MD5HMacTest(),
^
RegressionTest.java:51: cannot find symbol
symbol : class SHA1HMacTest
location: class org.bouncycastle.crypto.test.RegressionTest
new SHA1HMacTest(),
^
RegressionTest.java:52: cannot find symbol
symbol : class RIPEMD128HMacTest
location: class org.bouncycastle.crypto.test.RegressionTest
new RIPEMD128HMacTest(),
^
RegressionTest.java:53: cannot find symbol
symbol : class RIPEMD160HMacTest
location: class org.bouncycastle.crypto.test.RegressionTest
new RIPEMD160HMacTest(),
^
RegressionTest.java:54: cannot find symbol
symbol : class OAEPTest
location: class org.bouncycastle.crypto.test.RegressionTest
new OAEPTest(),
^
RegressionTest.java:55: cannot find symbol
symbol : class PSSTest
location: class org.bouncycastle.crypto.test.RegressionTest
new PSSTest(),
^
RegressionTest.java:56: cannot find symbol
symbol : class CTSTest
location: class org.bouncycastle.crypto.test.RegressionTest
new CTSTest(),
^
RegressionTest.java:57: cannot find symbol
symbol : class PKCS5Test
location: class org.bouncycastle.crypto.test.RegressionTest
new PKCS5Test(),
^
RegressionTest.java:58: cannot find symbol
symbol : class PKCS12Test
location: class org.bouncycastle.crypto.test.RegressionTest
new PKCS12Test(),
^
RegressionTest.java:59: cannot find symbol
symbol : class GOST28147Test
location: class org.bouncycastle.crypto.test.RegressionTest
new GOST28147Test(),
^
RegressionTest.java:60: cannot find symbol
symbol : class GOST3410Test
location: class org.bouncycastle.crypto.test.RegressionTest
new GOST3410Test(),
^
RegressionTest.java:61: cannot find symbol
symbol : class WhirlpoolDigestTest
location: class org.bouncycastle.crypto.test.RegressionTest
new WhirlpoolDigestTest()
^
47 errors
C:\org\bouncycastle\crypto\test>
Am i compiling this correctly? is the classpath correct?
Thanks for helping me with this.
|
|

04-17-2008, 05:51 AM
|
 |
Senior Member
|
|
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
|
|
Debugging time!!!!
regards,
sukatoa
|
|

04-17-2008, 06:00 AM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 9
|
|
The code was sample code from the BC zip file plus they are all the same type of error. i think it might be something with my classpath or how i am compiling the program
I didn't even write this code but here it is anyways
package org.bouncycastle.crypto.test;
import org.bouncycastle.crypto.test.GOST28147Test;
import org.bouncycastle.crypto.test.GOST3410Test;
import org.bouncycastle.util.test.*;
public final class RegressionTest
{
private RegressionTest()
{ };
private static Test[] _tests = {
new AESTest(),
new DESTest(),
new DESedeTest(),
new ModeTest(),
new DHTest(),
new ElGamalTest(),
new DSATest(),
new ECTest(),
new ECIESTest(),
new MacTest(),
new RC2Test(),
new RC4Test(),
new RC5Test(),
new RC6Test(),
new RijndaelTest(),
new SerpentTest(),
new SkipjackTest(),
new BlowfishTest(),
new TwofishTest(),
new CAST5Test(),
new CAST6Test(),
new IDEATest(),
new CamelliaTest(),
new RSATest(),
new ISO9796Test(),
new MD2DigestTest(),
new MD4DigestTest(),
new MD5DigestTest(),
new SHA1DigestTest(),
new SHA256DigestTest(),
new SHA384DigestTest(),
new SHA512DigestTest(),
new RIPEMD128DigestTest(),
new RIPEMD160DigestTest(),
new TigerDigestTest(),
new MD5HMacTest(),
new SHA1HMacTest(),
new RIPEMD128HMacTest(),
new RIPEMD160HMacTest(),
new OAEPTest(),
new PSSTest(),
new CTSTest(),
new PKCS5Test(),
new PKCS12Test(),
new GOST28147Test(),
new GOST3410Test(),
new WhirlpoolDigestTest()
};
public static void main(
String[] args)
{
for (int i = 0; i != _tests.length; i++)
{
TestResult result = _tests[i].perform();
System.out.println(result);
}
}
}
Last edited by notwist : 04-17-2008 at 06:02 AM.
|
|

04-17-2008, 06:11 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,376
|
|
Seems to me few classes are can't find there. Like AESTest ans do many.
And also, set the class path as follows and try.
path=C:\Program Files\Java\jdk1.6.0_05\bin\
Then use javac to compile and java to run the application.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-17-2008, 06:33 AM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 9
|
|
Hmm, I changed the classpath but i'm still getting those errors.
I tried compiling another example program and while it did compile, I got an error when I tried running it.
C:\Documents and Settings\Bill\Desktop\crypto-139\src\org\bouncycastle\crypto\examples>javac DESExample.java
C:\Documents and Settings\Carl\Desktop\crypto-139\src\org\bouncycastle\crypto\examples>java DESExample
Exception in thread "main" java.lang.NoClassDefFoundError: DESExample
Caused by: java.lang.ClassNotFoundException: DESExample
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
C:\Documents and Settings\Bill\Desktop\crypto-139\src\org\bouncycastle\crypto\examples>
|
|

04-17-2008, 06:37 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,376
|
|
|
So few classes are missing in you package. Are you sure you have collect the complete set of classes. As I said on my previous replay there are few classes missing, you get FileNotFoundException.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-17-2008, 06:43 AM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 9
|
|
|
Are you talking about the last program I posted. I will have to look into this and see. But I thought only the Provider was needed to compile these programs? I guess i was mistaken.
|
|

04-17-2008, 06:58 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,376
|
|
Originally Posted by notwist
But I thought only the Provider was needed to compile these programs? I guess i was mistaken.
May be. You can compile the code, because reference not used in compile time here. You have already done it. But you can't run it. Check what your provider want to do 
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-17-2008, 06:40 PM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 9
|
|
|
I set the classpath to point to the provider, changed the security file, and checked everything yet I'm still getting these errors. This is getting annoying!
|
|

04-17-2008, 09:23 PM
|
 |
Member
|
|
Join Date: Apr 2008
Posts: 36
|
|
|
Could you give a link or something so we can download the samples. I would like to check them out....
__________________
-- To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. --
Cheer up, the worst has yet to come...
|
|

04-18-2008, 11:41 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,376
|
|
Originally Posted by bobleny
Could you give a link or something so we can download the samples. I would like to check them out....
Yes, it could be a good point. 
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|