简体   繁体   English

是否可以在 Rust 上验证 NEAR 智能合约中的 NIST P-256 曲线?

[英]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.我正在考虑使用 iOS Secure Enclave 对其中一个签名进行多重签名。 However it only supports NIST P-256 curve.但是它只支持 NIST P-256 曲线。

I know it's not supported on protocol level, but is it possible to implement it in Rust smart contract?我知道它在协议级别不受支持,但是否可以在 Rust 智能合约中实现它? If so – where do I start?如果是这样——我从哪里开始?

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.目前,即使您可以在智能合约 NIST P-256 曲线内进行验证(这里有用于验证的库,例如 - https://github.com/RustCrypto/elliptic-curves/tree/master/p256 ),您仍然需要首先使用一些 ED25519 或 SECP-256K1 密钥签署交易,以便在执行合约代码之前真正让区块链接受它。

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.我的理解是,现在您可以将字节序列存储在安全飞地中并将其读出并在用户空间中签署任何 function。 Here how it can be done securely - https://github.com/AlphaWallet/alpha-wallet-ios/pull/1272在这里如何安全地完成 - 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.如果这是支持 iOS 安全飞地唱歌的重要考虑因素,您可以创建规范更改提案以添加 SECP-256P1(即 NIST P-256)作为 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.它有明显的缺点,但这也是一个明显的优点,它是可选的,因此每个用户都可以决定他们更喜欢使用哪条曲线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM