For Programmers: Free Programming Magazines  


Home > Archive > Java Security > March 2004 > encrypt using RSA? (newbee)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author encrypt using RSA? (newbee)
stig

2004-03-19, 8:54 pm

hi
wanted to make a test to encrypt/decrypt using RSA.

ia managed to create the public and private key but have problem using
them to encrypt anything.

i try to create a Cipher (as one can do using DES), but then i get:

Cipher rsaCipher;
rsaCipher = Cipher.getInstance("RSA");

when i run the proram i get:
java.security.NoSuchAlgorithmException: Cannot find any provider
supporting RSA


maybee i should do it in a rather different way, but how?

thanks
stig
Michel Gallant

2004-03-19, 8:54 pm

Here are some simple samples which compare RSA encryption in Java2, .NET
and CryptoAPI:
http://www.jensign.com/JavaScience/dotnet/RSAEncrypt

- Michel Gallant
MVP Security
http://www.jensign.com

"stig" <_nospam_stigerikson@yahoo.se> wrote in message news:c1puld$a21$1@oden.abc.se...
> hi
> wanted to make a test to encrypt/decrypt using RSA.
>
> ia managed to create the public and private key but have problem using
> them to encrypt anything.
>
> i try to create a Cipher (as one can do using DES), but then i get:
>
> Cipher rsaCipher;
> rsaCipher = Cipher.getInstance("RSA");
>
> when i run the proram i get:
> java.security.NoSuchAlgorithmException: Cannot find any provider
> supporting RSA
>
>
> maybee i should do it in a rather different way, but how?
>
> thanks
> stig



GianpieroP

2004-03-19, 8:54 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"stig" <_nospam_stigerikson@yahoo.se> ha scritto nel messaggio
news:c1puld$a21$1@oden.abc.se...

| java.security.NoSuchAlgorithmException: Cannot find any provider
| supporting RSA

You're using Java Cryptography Architecture (JCA).
To work with it, you must use one or more
cryptographic provider.

A Cryptographic provider provides you some implementation of
known cryptographic algorithms (including RSA).

Exception (reported above) indicates you that Security System can't
find
any provider implementing RSA algorithm.

You can get a free provider (called BouncyCastle Provider)
from web at http://www.bouncycastle.org or .com (I don't remember).

Now you must proceeded in this way:

1. Add the jar file that you have downloaded from BC
site (as indicated above) to your classpath.

2. Register BC provider dinamically into your Security
System as below:
Security.addProvider(new
org.bouncycastle.jce.provider.BouncyCastleProvider());

3. Use RSA implementation provided by BC (Bouncy Castle)
as follow:
rsaCipher = Cipher.getInstance("RSA"); or explicity
rsaCipher = Cipher.getInstance("RSA","BC");

I hope that my english is readable :-(

Hi,
GianpieroP

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/ AwUBQEPGFZ4sPKh9SaicEQJasgCgysbl54qGsbTq
xQ7B8iNMoipLTdgAnjTY
36vTsba/OpFMTGPk0898Az/l
=8bkv
-----END PGP SIGNATURE-----


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com