-
Notifications
You must be signed in to change notification settings - Fork 50
Add Verifiable Message Signing #360
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also update the client SDKs under sdk/
. It is also recommended to add a corresponding Verify()
API as a counterpart to Sign()
.
message SignResponse { | ||
bytes signature = 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message SignResponse { | |
bytes signature = 1; | |
} | |
message SignResponse { | |
// the signature of the data | |
bytes signature = 1; | |
// The signature chain consists of the following signatures: | |
// [0] - the signature of the data | |
// [1] - the k256 signature of the message signing pubkey signed by the app root key | |
// [2] - the k256 signature of the app root pubkey signed by the KMS root key | |
repeated bytes signature_chain = 2; | |
// The public key signing the data | |
bytes public_key = 3; | |
} |
The signature_chain[1:2]
can be optained from the response of GetKey.
// Derived key | ||
bytes key = 1; | ||
// Derived k256 signature chain | ||
// Derived signature chain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Derived signature chain | |
// The signature chain consists of the following signatures: | |
// [0] - the k256 signature of the derived pK signed by the app root key | |
// [1] - the k256 signature of the app root pK signed by the KMS root key |
let key_response = self | ||
.get_key(GetKeyArgs { | ||
path: "vms".to_string(), | ||
purpose: "signing".to_string(), | ||
algorithm: "ed25519".to_string(), | ||
}) | ||
.await?; | ||
let key_bytes: [u8; 32] = | ||
key_response.key.try_into().expect("Key is incorrect"); | ||
Ed25519SigningKey::from_bytes(&key_bytes) | ||
.verifying_key() | ||
.to_bytes() | ||
.to_vec() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be unnecessary. Typically, CVM1 signs a message for verification in CVM2.
let key_response = self | ||
.get_key(GetKeyArgs { | ||
path: "vms".to_string(), | ||
purpose: "signing".to_string(), | ||
algorithm: request.algorithm, | ||
}) | ||
.await?; | ||
let signing_key = SigningKey::from_slice(&key_response.key) | ||
.context("Failed to parse secp256k1 key")?; | ||
signing_key.verifying_key().to_sec1_bytes().to_vec() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
No description provided.