Skip to content
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

KMS: add asymmetric keys samples #1638

Merged

Conversation

daniel-sanche
Copy link
Member

Added samples for the KMS Asymmetric Keys launch

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 16, 2018
@engelke engelke self-assigned this Aug 16, 2018
Copy link
Contributor

@engelke engelke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor point: hanging indents ending on lines 110 and 133 of asymmetric.py have closing paren on lines by themselves. Also, closing braces in lines 34 through 38 of asymmetric_test.py not completely consistent, though all are perfectly clear. Other hanging indents have them at the end of the last line.

LGTM

Copy link
Contributor

@engelke engelke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daniel-sanche daniel-sanche merged commit 4831bba into GoogleCloudPlatform:master Aug 17, 2018
def signAsymmetric(message, client, key_path):
"""Create a signature for a message using a private key stored on Cloud KMS
"""
digest_bytes = hashlib.sha256(message.encode('ascii')).digest()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually varies based on the key algorithm. For EC P-384 keys, it needs to be SHA-384.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think leaving a comment explaining this above this line would be sufficient?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!-- or something similar to what you did in the Golang lib, where the sample method was obviously limited to a particular key+digest combo.

s2 = create_key_helper(t.rsaSignId, t.rsaSign, 'ASYMMETRIC_SIGN',
'RSA_SIGN_PSS_2048_SHA256', t)
s3 = create_key_helper(t.ecSignId, t.ecSign, 'ASYMMETRIC_SIGN',
'EC_SIGN_P224_SHA256', t)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P224 was dropped from the API

busunkim96 pushed a commit to googleapis/python-kms that referenced this pull request Jun 4, 2020
dandhlee pushed a commit that referenced this pull request Nov 14, 2022
parthea pushed a commit to googleapis/google-cloud-python that referenced this pull request Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants