Add secp256r1 #1435
Replies: 5 comments 19 replies
-
Use CasesIf you have a use case for using ecdsa secp256r1, beyond webauthn, please post about it in reply to this in the thread of this comment. |
Beta Was this translation helpful? Give feedback.
-
Dear Leigh, I hope this message finds you well. I have been closely following the development of CAP-0051, "Smart Contract Host Functionality: Secp256r1 Verification," and am impressed by the initiative to enhance the Stellar ecosystem's capabilities, particularly in supporting secp256r1 for Webauthn applications. Your work is paving the way for innovative and secure implementations within the Stellar network, and I believe there is an opportunity to further leverage this functionality. I would like to propose an additional use case that could significantly benefit from the integration of secp256r1 verification into Soroban smart contracts: Decentralized Identity (DID) Based Payments. This concept utilizes ECDSA secp256r1 for secure identity verification, enabling a new paradigm for payment processes that are secure, private, and efficient. By associating DIDs with Stellar accounts and leveraging the cryptographic strengths of secp256r1, we can facilitate secure and seamless transactions, streamline KYC/AML compliance, and support cross-border payments with enhanced privacy and reduced costs. I believe this use case aligns well with Stellar's goals of increasing accessibility to financial services and promoting security and privacy in digital transactions. It could also serve as a compelling addition to the range of applications supported by CAP-0051, demonstrating the versatility and impact of the proposed enhancements, and we would be more than happy to pioneer the implementation of this solution in our Mozart project. I'm keen to hear your perspective on this concept. My enthusiasm for contributing to the development of this CAP is strong, and I believe that integrating DIDs into our discussions could unlock fresh opportunities for innovation within the Stellar network. Thank you for considering this use case idea. I look forward to your feedback and am hopeful for the opportunity to contribute to the Stellar community's efforts in advancing secure and versatile blockchain solutions. Best regards, |
Beta Was this translation helpful? Give feedback.
-
A few questions and suggestions regarding the input arguments to the host function:
The public key can be either compressed or uncompressed, and the 1 prefix byte specifies the it. By declaring it 65 bytes, I assume it is only accepting the uncompressed form (1 byte prefix + 32 byte x component + 32 byte y component)?
I think we should in addition require the hash length to be 32 bytes. As far as I understand, if the hash length is longer than 32 bytes (the order of p256 curve), additional bytes are truncated. Using a shorter hash is less secure.
We should also restrict the S to be in the lower range to prevent signature malleability. It is pretty standard practice in blockchain to prevent malleability attack by rejecting the higher variant (e.g. in bitcoin). We are also doing the same in our current k256 implementation. I'm not sure if it is standard practice on the "source" side though e.g. if the hardware module or WebAuthn signing libraries to mandate low S value as well. It would be beneficial to have someone with cryptography background to also chime in. |
Beta Was this translation helpful? Give feedback.
-
Regarding performance, according EIP-7212:
Assuming our host implementation will be in the similar ballpark. The cpu cost of secp256k1 key recovery ( (cc @MonsieurNicolas who brought it up in the protocol meeting and @graydon @leighmcculloch who responded) Edit: I'm planning to perform preliminary calibration analysis of the host implementation, and will post back the results. |
Beta Was this translation helpful? Give feedback.
-
Here are some calibration results as promised above. The results are split into 'compute' and 'decode' (since both have to be metered). ComputeConclusion:
DecodeConclusion:
|
Beta Was this translation helpful? Give feedback.
-
Starting a discussion thread for discussing the proposal to add secp256r1 signature verification to the Soroban host functions in a future protocol.
The proposal is here: https://github.com/stellar/stellar-protocol/blob/master/core/cap-0051.md
Beta Was this translation helpful? Give feedback.
All reactions