Any easy way to verify secp256r1 (NIST P256) ECDSA signature?
xomexh opened this issue · 3 comments
The custom curve params for the NIST curve does not seem to work. Anyway/any work around as to how a P256 ECDSA signature?
Using curve params as:
const secp256r1Params: CurveParams = {
name: 'secp256r1',
modulus: 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFn,
order: 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551n,
a: -3n,
b: 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604Bn,
generator: {
x: 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296n,
y: 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5n,
},
};```
Hey! Unfortunately, we currently only support foreign curves with curve parameter a !== 0
, and here a = -3
To support curves with a = 0
, we would have to implement the a = 0
case in the code base
Thank you for the reply, I would see I'd see for myself if I could do something about this.
Also another completely unrelated issue/doubt, is there an easy way to pass a composite struct having string data inside to a zkProgram?
This inherently doesn't give any errors, but the values of sig and msg are not accessible inside prove-able code (inside the methods of zkProgram) i.e I get no value from these fields of sig and msg.
Example:
class P256_Signature_Field extends Struct({
sig: String,
msg: String
}){
constructor(value:{sig:string, msg:string}){
super(value)
}
}
Also another completely unrelated issue/doubt, is there an easy way to pass a composite struct having string data inside to a zkProgram?
You can't work with strings inside provable code, you would have to convert your strings into Field elements using an encoding