Vlad Grichina
Vlad Grichina

Reputation: 1069

Is it possible to verify NIST P-256 curve in NEAR smart contract on Rust?

I'm considering doing multisig with one of signatures using iOS Secure Enclave. However it only supports NIST P-256 curve.

I know it's not supported on protocol level, but is it possible to implement it in Rust smart contract? If so – where do I start?

Upvotes: 4

Views: 235

Answers (1)

ilblackdragon
ilblackdragon

Reputation: 1835

Currently even if you can verify inside the smart contract NIST P-256 curve (here are libraries for verification, for example - https://github.com/RustCrypto/elliptic-curves/tree/master/p256), you would still need to sign the transaction with some ED25519 or SECP-256K1 key first to actually get blockchain to accept it before the contract code will be execute.

My understanding is that right now you can just store sequence of bytes in secure enclave and read it out and sign any function in user land. Here how it can be done securely - https://github.com/AlphaWallet/alpha-wallet-ios/pull/1272

If this is an important consideration to support iOS secure enclave singing, you can create a spec change proposal to add SECP-256P1 (which is NIST P-256) as an alternative key type to NEAR. It would have obvious downsides, but this is a clear upside as well and it's optional so each individual user can decide which curve they prefer to use.

Upvotes: 3

Related Questions