-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Labels
Description
Overview:
To improve integration with external Key Management Services (KMS) that only support P-256 (NIST curve secp256r1), we propose extending mpcium's identity and event verification logic to support p256 in addition to the current default ed25519.
1. Signature Algorithm Selection
-
Support two signature algorithms:
ed25519(default)p256(NIST secp256r1, ECDSA)
-
New CLI flag for
generate-initiator--algorithm [ed25519|p256] # default: ed25519
-
If
--algorithmis not provided, default toed25519.
2. Public Key Input for P-256
mpcium
-
If
--algorithm=p256, require:--pubkey path/to/pubkey.pem
-
PEM file must contain a valid ECDSA P-256 public key.
-
The private key is never used or required.
-
For
ed25519, the keypair continues to be generated internally.
3. Event initiator identity File Format
Update the identity file to include:
{
"algorithm": "p256",
"public_key": "<base64-encoded DER or hex string>",
...
}algorithmmust always be present.public_keymust be stored regardless of algorithm source.
5. Signature Verification Logic
Update the signature verification logic:
func (store *identityStore) VerifyInitiatorMessage(msg InitiatorMessage) error {
algorithm := msg.Algorithm() // New method
switch algorithm {
case "ed25519":
return store.verifyEd25519Message(msg)
case "p256":
return store.verifyP256Message(msg)
default:
return fmt.Errorf("unsupported signature algorithm: %s", algorithm)
}
}6. verifyP256Message Implementation
- Use
crypto/ecdsawithelliptic.P256()andsha256hash. - Load public key from message or identity.
- Verify the ECDSA signature against the SHA-256 hash of the message.
- Normalize public key to a consistent format (e.g., from PEM or base64).
7. Node Configuration Support
Allow static configuration in config.yaml:
event_initiator_algorithm: "p256" # or "ed25519", default: ed25519
event_initiator_pubkey: "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE..." # base64 DER8. Backward Compatibility
- If
algorithmis not defined:- Assume
ed25519for identity generation and verification.
- Assume
- No changes required for existing
ed25519identities or initiators.
gosunuts
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done