-
Notifications
You must be signed in to change notification settings - Fork 28
Supported p256 for event initiator #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
|
Resolves #67 |
Fixed linting errors
52b84c9 to
67d5517
Compare
0ed86c1 to
c8aaaab
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
@nann-cheng feel free to review when you have time. We support event initiator signing with p256 curve which is supported by major cloud kms. |
|
all good @tuananhk13bk ? I think we can merge |
Yes looks good to me. |
|
thanks for contribution. |
Example for signing a msg on the backend side:
The best practice to keep in mind here is that it signs the sha256 hash of the message, not the message itself.
Reference link:
https://cryptobook.nakov.com/digital-signatures/ecdsa-sign-verify-messages
Test with AWS KMS (Localstack)
1. Create a P256 keypair in AWS KMS:
aws kms create-key \ --endpoint-url=http://localhost:4566 \ --description "Test P-256 keypair" \ --key-usage SIGN_VERIFY \ --customer-master-key-spec ECC_NIST_P256Expected response:
{ "KeyMetadata": { "AWSAccountId": "000000000000", "KeyId": "330a9df7-4fd9-4e86-bfc5-f360b4c4be39", "Arn": "arn:aws:kms:ap-southeast-1:000000000000:key/330a9df7-4fd9-4e86-bfc5-f360b4c4be39", "CreationDate": "2025-08-28T16:42:18.487655+07:00", "Enabled": true, "Description": "Test P-256 keypair", "KeyUsage": "SIGN_VERIFY", "KeyState": "Enabled", "Origin": "AWS_KMS", "KeyManager": "CUSTOMER", "CustomerMasterKeySpec": "ECC_NIST_P256", "KeySpec": "ECC_NIST_P256", "SigningAlgorithms": [ "ECDSA_SHA_256" ], "MultiRegion": false } }2. Get the public key:
Expected response:
3. Sign a message
aws kms sign \ --endpoint-url=http://localhost:4566 \ --key-id 4428f130-0a25-4e78-b563-9e8a9e23110a \ --message $(echo '{"user":"john.doe","action":"login","timestamp":"2025-08-28T10:30:00Z"}' | base64 -w 0) \ --message-type RAW \ --signing-algorithm ECDSA_SHA_256Expected response:
{ "KeyId": "arn:aws:kms:ap-southeast-1:000000000000:key/4428f130-0a25-4e78-b563-9e8a9e23110a", "Signature": "MEUCIC8xSkhWdLfUPfk7nW64+IaMOSacQvS7FiHmFQKpVuo5AiEAtutVr0NNikPyI1KZahN6CpDA+7a9LHd/8F6n3013ENY=", "SigningAlgorithm": "ECDSA_SHA_256" }