0

I was look around the answer and googling to find a way how to encrypt and decrypt a string with El-Gamal Elliptic Curve without any third party library but there's always the answer to use a third party library like bo*...castle or fle**provider. In order to prevent dependencies in my program I decided to use java security because as I ever ask and discuss from my question following this thread it can be done without any third party library, but in that (thread) case the purpose is to sign/verify, now:

  1. HOW or is that possible to do the encryption/de with ElGamal ECC with Java(JDK 7+) native ?
  2. From that linked thread above, im using base64 method to store the private and the public key, can i do the same way in El-Gamal ECC ?
  3. Is there anybody with the brave heart :) to answer with an example code to encrypt/de by EL-Gamal ECC in java(jdk 7 or 8) native ?
Community
  • 1
  • 1
Rhony
  • 86
  • 1
  • 10
  • If you aren't strong enough in crypto to understand how to turn El-Gamal into a stream cipher, please do not try to implement it yourself in Java. You will certainly end up with something that has subtle, fatal flaws. If you insist on proceeding however, http://en.wikipedia.org/wiki/ElGamal_encryption has an overview and http://www.ams.org/journals/mcom/1987-48-177/S0025-5718-1987-0866109-5/ has details. The key exchange alrgorithm (Diffie-Hellman) is already in JCE core with name "DH". – BadZen Jan 13 '15 at 16:37
  • What you should be using: https://www.bouncycastle.org/ – BadZen Jan 13 '15 at 16:38
  • So there's impossible / jdk doesn't provide method to encrypt/de with el-gamal Ecc ? – Rhony Jan 13 '15 at 16:47
  • Out of the box the default provider does not have a Cipher implementation that is based on the EC El-Gamal cryptosystem, no. http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html – BadZen Jan 13 '15 at 16:53
  • Thanks for your suggestion, but im going to use flexiprovider and i got error, can you help me please. [My question link](http://stackoverflow.com/questions/27938781/flexiprovider-how-to-encrypt-de-with-formatted-keypair) – Rhony Jan 14 '15 at 09:14
  • Why are you using ElGamal? Do you need its homomorphic properties? For general purpose asymmetric encryption I'd rather recommend ECIES style encryption. – CodesInChaos Jan 14 '15 at 09:50
  • yes, i change my mind to decided using ECIES, can you help me please, following my [question](http://stackoverflow.com/questions/27938781/flexiprovider-how-to-encrypt-de-with-formatted-keypair) – Rhony Jan 14 '15 at 10:10
  • That works also - probably more people have looked at BC's source however. Either will work. You'll need to post the exact error /w code for us to help you with that, though. It's probably worth starting a new question. – BadZen Jan 16 '15 at 23:04
  • i was making a new thread discussion, answered and solved by myself about this problem, if you want to look at that please refer this [thread](http://stackoverflow.com/questions/27938781/flexiprovider-how-to-encrypt-de-with-formatted-keypair) – Rhony Jan 18 '15 at 11:07

0 Answers0