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

Make it clear what to do if encryption/decryption fails #14

Closed
shyiko opened this issue Jul 31, 2018 · 1 comment
Closed

Make it clear what to do if encryption/decryption fails #14

shyiko opened this issue Jul 31, 2018 · 1 comment

Comments

@shyiko
Copy link
Owner

shyiko commented Jul 31, 2018

e.g. gcloud auth application-default login or GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json might be needed in case of Google Cloud KMS backend.

@philicious
Copy link

its also handy to check the permissions someone has on a certain keyring/key. to ensure someone has or doesnt have access

export TOKEN=$(gcloud beta auth application-default print-access-token)
# fill in PROJECT_ID, LOCATION_OF_KEYRING, KEYRING_NAME, KEY_NAME
curl -X POST -H "Content-Type: application/json" -d '{"permissions": ["cloudkms.cryptoKeyVersions.useToDecrypt","cloudkms.cryptoKeyVersions.useToEncrypt"]}' -H "Authorization: Bearer $TOKEN" https://cloudkms.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_OF_KEYRING/keyRings/KEYRING_NAME/cryptoKeys/KEY_NAME:testIamPermissions

if the user HAS permissions, it will respond with

{
  "permissions": [
    "cloudkms.cryptoKeyVersions.useToDecrypt",
    "cloudkms.cryptoKeyVersions.useToEncrypt"
  ]
}

oherwise the array is empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants