Skip to content

Add certificate subcommands, key delete, and ctk command for macOS#316

Open
maraino wants to merge 1 commit intomainfrom
mariano/delete
Open

Add certificate subcommands, key delete, and ctk command for macOS#316
maraino wants to merge 1 commit intomainfrom
mariano/delete

Conversation

@maraino
Copy link
Copy Markdown
Contributor

@maraino maraino commented Apr 2, 2026

Description

This PR adds the following changes:

  • Add certificate copy and delete subcommands
  • Add key delete subcommand
  • Add ctk command (macOS/CGO) to list CryptoTokenKit identities with table, JSON, and PEM output modes, token filtering, and serial lookup
  • Update copyright year to 2022-2026 across all files

I had an old delete command and a simple ctk command but I've used claude code to improve them.

- Add certificate copy and delete subcommands
- Add key delete subcommand
- Add ctk command (macOS/CGO) to list CryptoTokenKit identities with
  table, JSON, and PEM output modes, token filtering, and serial lookup
- Update certificate and key command descriptions to reflect new capabilities
- Update copyright year to 2022-2026 across all files
@maraino maraino requested a review from a team as a code owner April 2, 2026 22:42
@maraino maraino requested review from hslatman and removed request for a team April 2, 2026 22:43
@hslatman hslatman changed the title add certificate subcommands, key delete, and ctk command for macOS Add certificate subcommands, key delete, and ctk command for macOS Apr 3, 2026
Copy link
Copy Markdown
Member

@hslatman hslatman left a comment

Choose a reason for hiding this comment

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

Great functionality; looks good overall.

Just some thoughts on the copy command, and JSON marshaling.

I believe the Apple framework interop code was (largely) taken from existing code, so I didn't look too deep into that this time.

Comment on lines +33 to +34
Short: "copy a certificate into a KMS",
Long: `Copies a certificate into a KMS from a PEM file or another KMS URI.`,
Copy link
Copy Markdown
Member

@hslatman hslatman Apr 3, 2026

Choose a reason for hiding this comment

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

It copies multiple certs when the source has multiple certs.

Making it a "certificate chain" isn't entirely correct (although that's the method that's being used on the KMS), as there's no check that it's an actual (partial) chain. Maybe "certificate (bundle)" works, but could be confusing in combination with the --bundle flag. Or do a check if it's an actual chain before storing (I don't believe we do that in each KMS, but maybe we should?), and then use "certificate (chain)".

It's possible that a source has multiple certs, and the destination doesn't support storing multiple. Right now that would result in only the first cert being stored, without the user getting to know that fact. This might be OK, but maybe we should print something indicating this case?

Comment on lines +187 to +196
type jsonEntry struct {
Subject string `json:"subject"`
Serial string `json:"serial"`
NotBefore string `json:"not_before"`
NotAfter string `json:"not_after"`
Token string `json:"token"`
KeyType string `json:"key_type"`
KeySize int `json:"key_size"`
}
out := make([]jsonEntry, len(entries))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn't the ctkEntry work for marshaling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants