A lot of reading of Google Cloud KMS keyrings and keys during signing
See original GitHub issueSTR:
- Generate asymmetric key and CA
gcloud kms keyrings create test --location <region>```
gcloud kms keys create my-key --keyring test --location <region> --purpose "asymmetric-signing" --default-algorithm "rsa-sign-pkcs1-2048-sha256"
openssl genrsa -out ca.key 2048
- Create CSR and Certificate
git clone https://github.com/mattes/google-cloud-kms-csr
cd google-cloud-kms-csr
go build -o csr
./csr -key $(gcloud kms keys versions list --key my-key --keyring test --location=<region>) -out my.csr --common-name MyOrg
openssl -req -in my.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out my.crt
- Run jsign
for i in {1..1000}; do
jsign --storetype GOOGLECLOUD
--storepass "$(gcloud auth print-access-token)"
--keystore "projects/<project>/locations/<location>/keyRings/test"
--alias "my-key"
--certfile my.crt
my.exe
done
Expected result: Binary signed
Actual result:
java.io.IOException: 429 - RESOURCE_EXHAUSTED: Quota exceeded for quota metric 'Read requests' and limit 'Read requests per minute' of service 'cloudkms.googleapis.com' for consumer 'project_number:<project-id>
So, each run of jsign makes 2 reading and 1 crypto operation. But default quotas are:
- Cryptographic requests per minute: 60,000
- Read requests per minute: 300
Also jsign require a lot of permissions for one signing For key:
cloudkms.cryptoKeyVersions.list
cloudkms.cryptoKeyVersions.useToSign
cloudkms.locations.get
cloudkms.locations.list
resourcemanager.projects.get
For keyring:
cloudkms.cryptoKeys.list
Actually only one permission required cloudkms.cryptoKeyVersions.useToSign
and only 2 parameters to run key.id (example: projects/<project id>/locations/<location>/keyRings/<keyring>/cryptoKeys/<key name>/cryptoKeyVersions/<version>
and algorithm (example: RSA).
I have 2 suggestions:
- Cache keys list and keys versions list between runs of jsign
- Add ability to specify only key.id and algorithm
I will try to implement second.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Quickstart: Create encryption keys with Cloud KMS
Sign in to your Google Cloud account. If you're new to Google Cloud, ... Important: This quickstart creates Cloud KMS resources such as...
Read more >Google Cloud KMS - Secrets Engines - HTTP API | Vault
This is the API documentation for the Vault Google Cloud KMS secrets engine. ... key ( string: "" ) - Name of the...
Read more >How to send encoded KMS keyring information in google ...
How to send KMS keyring information in encoded format in google signed URL for customer managed encryption key.
Read more >How to secure and manage secrets using Google Cloud KMS
At runtime, we'll load encrypted files, decrypt using KMS APIs and use it. Cloud KMS is a cloud-hosted key management service that lets...
Read more >Getting Started with Cloud KMS | Google Cloud Skills Boost
How to start your lab and sign in to the Google Cloud Console. Click the Start Lab button. ... Note: CryptoKeys and KeyRings...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The request to get all the keys has been removed, there is now only one request per file signed.
I’d still recommend signing multiple files with a single invocation of jsign from the command line, it should be slightly faster.
Nice! Thank you for
torturingtesting Jsign thoroughly.