ECC Encryption / Decryption

271 views
Skip to first unread message

Sanath Prasanna

unread,
May 2, 2021, 7:33:51 AM5/2/21
to erlang-questions
Hi,
I want to encrypt a text message using ECC & need to decrypt. Can someone give me a sample for that process ?
Br,
Robert 

Jesper Louis Andersen

unread,
May 4, 2021, 11:18:34 AM5/4/21
to Sanath Prasanna, erlang-questions
On Sun, May 2, 2021 at 1:33 PM Sanath Prasanna <ahe.s...@gmail.com> wrote:
Hi,
I want to encrypt a text message using ECC & need to decrypt. Can someone give me a sample for that process ?

You will probably have to give more information.

There are several different types of ECC methods, and inside these, there are a couple of different elliptic curves you can choose from, and some of them are standardized requirements for certain applications.

Furthermore, ECC is often used as a tool in a larger toolbox. It's used to agree on a (shared) secret key for an underlying block or stream cipher, and in some situations also for agreeing on message authentication (which protects the message integrity against tampering).
Getting this toolbox / tooling construction wrong can result in the proposed solution being insecure, so beware.


--
J.

Sanath Prasanna

unread,
May 4, 2021, 10:39:08 PM5/4/21
to Jesper Louis Andersen, erlang-questions
Tx Jesper for your kind response.  Here attached my sample test file &  following one is not working. That is the expected other Encoding scheme. (ShaXxxx)
EncryptMsg = public_key:encrypt_private(Msg, ECPublicKey), (line 64)
Can you give some guide to over come this ?
br,
Robert
test.erl

Jesper Louis Andersen

unread,
May 5, 2021, 10:10:07 AM5/5/21
to Sanath Prasanna, erlang-questions
One particular problem is that `public_key:encrypt_private` is the RSA algorithm, and not ECC. You need `crypto:private_encrypt/4` if you want to do ECC.
--
J.

Sanath Prasanna

unread,
May 6, 2021, 11:10:21 PM5/6/21
to Jesper Louis Andersen, erlang-questions
Tx Jsesper for your guidance. But still I cannot do that & error came for below line
EncryptMsg = crypto:private_encrypt(rsa, Msg, ECPrivateKey, rsa_no_padding),
here attached sample file. 
test.erl

Sanath Prasanna

unread,
May 12, 2021, 7:07:36 AM5/12/21
to Jesper Louis Andersen, erlang-questions
Jesper, any comment regarding my problem ?
Br,
Robert

Jesper Louis Andersen

unread,
May 12, 2021, 7:44:07 AM5/12/21
to Sanath Prasanna, erlang-questions
I'm not your Oracle.
--
J.

Sanath Prasanna

unread,
May 12, 2021, 9:30:58 AM5/12/21
to Jesper Louis Andersen, erlang-questions
Hi Jesper,
Sorry for trouble you.. Tx for your guidance far. 
Br,
Robert.. 
Reply all
Reply to author
Forward
0 new messages