hyugit / EllipticCurve

An elliptic curve library written in Swift 4
MIT License
22 stars 5 forks source link

EC Point multiplication operation in iOS #10

Closed deepesh-vasthimal-cko closed 4 years ago

deepesh-vasthimal-cko commented 4 years ago

Hi All

I am trying to perform a EC point ( x, y ) multuplication with private EC key ( d ). I dont see much support or APIs in swift. However i did see some discussion happening on the swift community over this way back in 2019. Has anything change since then and do we have support to perform this stand EC point mulitplication with your library ?

refer : https://forums.swift.org/t/cryptography-for-the-swift-ecosystem/24728/21

refer : https://www.programcreek.com/java-api-examples/?class=org.bouncycastle.math.ec.ECPoint&method=multiply

Thanks

hyugit commented 4 years ago

You can use libsecp256k1 in production. For learning or other purposes, this lib can perform the point multiplication. It's just very slow.

deepesh-vasthimal-cko commented 4 years ago

Hi I have successfully imported secp256k1 in xcode using : https://github.com/keefertaylor/secp256k1.swift. How can i call the EC point multiplication for multiplying Pulbic EC point ( x, y ) with private EC key ( d ) ? , Can you please suggest. Example code will help.

Thanks Deepesh

deepesh-vasthimal-cko commented 4 years ago

On above i am calling secp256k1_ecdh method to create shared Z. But i get an error as below which is similar to described here : http://quabr.com:8182/60032275/using-secp256k1-in-xcode-and-build-is-failing. Can anyone please suggest ?

Log : - Undefined symbols for architecture x86_64: "_secp256k1_ecdh", referenced from: TestSec256k1.ViewController.viewDidLoad() -> () in ViewController.odd

hyugit commented 4 years ago

These issues are not related to my project. Please discuss it somewhere else. Thank you.

If you are missing symbols for your arch, it is most likely due to how you bridge the C source code and obj_c.