Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Can't get cryptography working with assymetric key  (Read 1804 times)
0 Members and 1 Guest are viewing this topic.
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Posted 2003-11-26 12:41:31 »

Can anyone explain this:
1  
2  
3  
4  
5  
java.security.NoSuchAlgorithmException: No such algorithm: RSA
      at javax.crypto.SunJCE_b.c(DashoA6275)
      at javax.crypto.SunJCE_b.a(DashoA6275)
      at javax.crypto.Cipher.a(DashoA6275)
      at javax.crypto.Cipher.getInstance(DashoA6275)

When trying to create a Cipher object? The J2SDK1.4.2 docs clearly state that RSA is an algorithm supported by Cipher, but the list of available algorithms actually supported also clearly doesn't have RSA in it.

I'm really, really annoyed Angry

Cas Smiley

Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #1 - Posted 2003-11-26 18:52:14 »

Quick Google for you:

http://forums.cookienest.com/mobile/thread.php?topic_id=7014&&start=10

Quote
This is just a pointer to the standard names. What algorithms are actually supported depends on the installed providers. You'll have to download and install a provider that implements a RSA cipher. (Rememeber in 1.4 this provider has to be signed).


FWIW, I've had no problems using the Cryptix implementation before, and the latest version seems to support a number of RSA variants.

Hellomynameis Charlie Dobbie.
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #2 - Posted 2003-11-26 22:04:59 »

The docs in this area suffer a serious case of shitness. Thanks Charlie, that's exactly what I need. I need to trim their jar down a little though!

(This is for credit card details encryption in Alien Flux)

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2003-11-27 18:40:15 »

Criminy! This is just the crappiest bit of programming I've had to do in years! Even with the Cryptix stuff it's still not working!

I only want to do one simple thing - encrypt an instance of a Serializable class and send it somewhere for decryption, such that only I know how to decrypt it. For this I am using RSA public/private ciphers supplied by Cryptix (as, unbelievably, J2RE1.4.2 doesn't actually include this functionality by default).

And it just doesn't work!

Has anybody got any suggestions about how to do this? Am I even doing the right thing in the first place?

Cas Smiley

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #4 - Posted 2003-11-28 15:19:40 »

Quote
Criminy! This is just the crappiest bit of programming I've had to do in years! Even with the Cryptix stuff it's still not working!


If you're still having trouble next week, mail me. I, ahem, haven't had internet access (nor even telephones!) for more than two weeks due to a major BT cockup, but am hoping to have something in place by Tuesday. Arrgh.

I'll have a root round my previous "fun" with encryption/decryption in 1.4.x, but agree entirely that it's got gaping holes in the docs. I have several times had a lot of excitement discovering that the many different methods relating to installed ciphers do completely pointless or weird and wonderful things, and it's damned easy to think you're enabling/loading/installing (different methods for each, with 3 possible interfaces to try each on, with different effects, IIRC!) a cipher, when you're not. It just looks like you are when you read the source code; you've actually called completely the wrong methods. Sad

malloc will be first against the wall when the revolution comes...
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2003-11-28 15:35:12 »

When I make it work in a bit tonight, not the way I wanted originally at all - I'm now using DES symmetric encryption which means I have to send an unencrypted key over the net anyway - I will post the code here and we can poke holes in the security.

I honestly think that for all the effort I've gone to I would have been better off just doing an XOR filter over the data.

Cas Smiley

Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #6 - Posted 2003-11-28 15:50:29 »

Mmm, now having said that I think I could get it to work the way I originally wanted anyway. I had some success with Cryptix getting RSA to encrypt really small things (<112 bytes or something daft like that) asymmetrically, so I can use RSA to encrypt the secret key and then the DES security is good.

Phew.

Why can't they just say "You can't use RSA to encrypt things over X bytes" somewhere? And how come the API doesn't prevent it? Damn and drat. You get what you pay for I suppose.

Cas Smiley

Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #7 - Posted 2003-11-29 02:08:07 »

RSA is also very slow.

About the bytes it can encrypt - I found this after googling: "RSA can
encrypt per encryption only the number of bits that equals the lenghh of its key" (http://www.rebol.net/list/list-msgs/32758.html) not sure how authorative that is however.

Will.

Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2003-11-29 10:37:46 »

Yes, that's entirely correct. What irks me is that you can create a CipherOutputStream with an RSA cipher and instead of following the "principle of least surprise" and doing what you intuitively want it to do - break your data up into chunks of this size - it just barfs if it's over 111 bytes.

And that's annoying.

But I think I'll be using it now in the way it was originally intended, to encrypt a runtime-generated secret key, which will secure my DES encoded credit card data.

This code looks generally so useful I will probably stuff it in the SPGL as generic classes in a while.

Cas Smiley

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (13 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (44 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!