Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / December 2004

Tip: Looking for answers? Try searching our database.

RSA and bouncycastle

Thread view: 
Matthias Ullrich - 06 Dec 2004 18:01 GMT
Hello,

I just wanted to sign some hashes.
So I came quickly to www.bouncycastle.org . The classes from
bouncycastle offer to generate keys, encrypt or sign data and verify the
result against the keypair. => fine

Unfortunatly there is no manual or tutorial or something like that. The
examples from BC-source I can not connect in my mind ...

what I wanna do:
1. generate keys
2. save keys to file(s)
3. read key from file(s)
4. sign hash
5. verify hash
6. generate certificate
7. verify certificate

Can someone help to solve my problem?
Or do you know some good tutorials that explain the usage of bouncycastle?

<code>

Security.addProvider(new BouncyCastleProvider());
KeyPairGenerator generator = KeyPairGenerator.getInstance(
        Constants.SEC_DEFAULT_ALGORITHM);
generator.initialize(Constants.SEC_DEFAULT_STRENGTH);
KeyPair keyPair    = generator.generateKeyPair();
PrivateKey prik    = keyPair.getPrivate();
PublicKey pubk     = keyPair.getPublic();

</code>

with this lines i created a keypair, but i have no idea how to save it
to a file (or into 2 files)

Thank you for any help
Matthias
Matthias Ullrich - 06 Dec 2004 18:34 GMT
> Security.addProvider(new BouncyCastleProvider());
> KeyPairGenerator generator = KeyPairGenerator.getInstance(
[quoted text clipped - 3 lines]
> PrivateKey prik    = keyPair.getPrivate();
> PublicKey pubk     = keyPair.getPublic();

I tried to create a Cipher with
Cipher cipher = Cipher.getInstance("RSA","BC");

But only an error occured:
The provider BC may not be signed by a trusted party

javax.crypto.cipher is content of the bouncycastle sources, but not in
the signed jar-file. so the original from java is used ?!?

any idea?
Matthias Ullrich - 06 Dec 2004 18:49 GMT
> I tried to create a Cipher with
> Cipher cipher = Cipher.getInstance("RSA","BC");
>
> But only an error occured:
> The provider BC may not be signed by a trusted party

A call of
Cipher cipher = Cipher.getInstance("RSA/PKCS1","BC");
rises the following error:
Invalid transformation format:RSA/PKCS1

i go crazy with that BC


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.