-
-
Notifications
You must be signed in to change notification settings - Fork 631
Admin: Support multiple private keys in a file #8550
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: main
Are you sure you want to change the base?
Conversation
Occasionally we need to bulk-revoke private keys. The PEM format naturally allows for multiple private keys, so extend the admin tool to support multiple keys in a file for revoke-by-key and block-by-key.
Make spkiHashesFromPrivateKeys include which key failed parsing/hashing. Ensure updated functions have matching pluralization better variable name keyPEMs
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.
Pull request overview
This PR extends the admin tool to support multiple private keys in a single PEM file for bulk revocation and blocking operations. The PEM format naturally supports multiple entries, and this change enables more efficient bulk operations when multiple keys need to be revoked or blocked simultaneously.
Key changes:
- Refactored
privatekey.Loadto extract a newLoadDERfunction that can process individual PEM blocks - Updated
spkiHashesFromPrivateKeysandserialsFromPrivateKeysto iterate through all keys in a file - Added comprehensive test coverage for multiple keys with different encoding formats (PKCS8 ECDSA, PKCS8 RSA, PKCS1 RSA)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| privatekey/privatekey.go | Extracted LoadDER function to enable parsing individual PEM blocks; updated error messages to reference PEM block type instead of file path |
| cmd/admin/key.go | Refactored spkiHashesFromPrivateKeys to loop through multiple PEM blocks in a file and compute hashes for each key |
| cmd/admin/cert.go | Updated serialsFromPrivateKeys to fetch serials for multiple keys and aggregate results |
| cmd/admin/key_test.go | Enhanced test to validate multiple keys with different formats (PKCS8 ECDSA/RSA, PKCS1 RSA) |
| cmd/admin/cert_test.go | Updated test function name to reflect new plural function name |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Occasionally we need to bulk-revoke private keys.
The PEM format naturally allows for multiple private keys, so extend the admin
tool to support multiple keys in a file for revoke-by-key and block-by-key.