using Elliptic curve Algorithm Encryption and Decryption not working and keys are not getting.
Asked
Active
Viewed 52 times
-4
-
Hi Eldar My question is Elliptic curve is asymmetrickey algorithm .but in above link ECIES Using Encrypt and Decrypt by AES Algoritham.but i want to do only with my EC Public and private keys – ramu yepuganti Aug 28 '23 at 11:54
-
The same answer mentions Diffie Hellman which afaik uses private and public keys? – Eldar Aug 28 '23 at 12:10
-
No ,using ECDH also doing same process in above link by use AES KEY for both encrypt and decrypt – ramu yepuganti Aug 28 '23 at 12:17
-
Above link ECDH using Encrypt and Decrypt for same key used(Public Key). – ramu yepuganti Aug 28 '23 at 12:22
-
Here is the [sample](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.ecdiffiehellmancng?view=net-7.0#examples) of ECDH. In the sample, Alice uses Bob's public key to send a message to Bob and Bob decrypts the message with his private key. Is this what you are looking for? – Eldar Aug 28 '23 at 12:35
-
1It sounds like you want Elliptic Curve El-Gamal encryption, which .Net does have support for. You can use the Bouncycastle library instead. – President James K. Polk Aug 28 '23 at 13:03
-
1Usually EC is used (in the context of a hyrid encryption) for the key agreement (ECDH). Though *direct* encryption with EC is possible (EC ElGamal, see previous comment), but is rather rarely used in practice. Why do you need a direct encryption with EC? Describe the use case. Maybe ECDH is enough. – Topaco Aug 28 '23 at 14:18
-
but my requirement is Encryption doing with public key and decryption with private key .but above case both encrypt and decrypt using same key(publickey) used. – ramu yepuganti Aug 28 '23 at 14:33
-
like RSA algoritham like i want to do in EC also using both public and private key using encrypt and decrypt process – ramu yepuganti Aug 28 '23 at 14:34
-
1RSA and EC are completely different algorithms. Just because encryption/decryption is possible with RSA does not mean it is possible with EC. As said before, usually ECDH is used, if you want to encrypt directly (for whatever reason) EC El-Gamal is an option. – Topaco Aug 28 '23 at 14:41
-
Hi Eldar ,your scenario doing generate two public keys for encryption and decryption purpose.bob key was not a private key.it is also public key.bobKey = bob.DeriveKeyMaterial(CngKey.Import(Alice.alicePublicKey, CngKeyBlobFormat.EccPublicBlob)) – ramu yepuganti Aug 28 '23 at 14:42
-
Hi Topaco ,Thanks for confirmation and ECDH use doing that is AES Algoritham not EC Algorithm. In ECDH using same key for Encrypt and Decrypt(Publickey) – ramu yepuganti Aug 28 '23 at 14:48