Skip to content

feat: add --friendly-name flag to step certificate p12 - #1688

Open
zorhehs wants to merge 1 commit into
smallstep:masterfrom
zorhehs:add-friendly-name-flag
Open

feat: add --friendly-name flag to step certificate p12#1688
zorhehs wants to merge 1 commit into
smallstep:masterfrom
zorhehs:add-friendly-name-flag

Conversation

@zorhehs

@zorhehs zorhehs commented Aug 23, 2026

Copy link
Copy Markdown

Closes #1004

What

Adds a --friendly-name flag to step certificate p12, letting users
override the default <subject> - <fingerprint> friendly name (alias)
used in the .p12 trust store — matching openssl pkcs12's -name
option.

Scope

This is scoped to the trust-store case (--ca only, no cert/key) and
to exactly one certificate:

  • The underlying go-pkcs12 library's Encoder.Encode() (used for the
    cert+key "identity store" case) doesn't expose a friendly-name
    parameter at all — it hardcodes LocalKeyId to the cert's SHA-1
    fingerprint. --friendly-name combined with a cert+key now fails
    with a clear error instead of being silently ignored.
  • Applying a single friendly name across multiple CA certificates isn't
    well-defined, so that combination is also rejected with a clear error.

I raised this scoping decision on the issue before implementing, in
case identity-store support is worth pursuing separately via a
library-level change.

Testing

  • Unit tests covering: friendly name applied correctly, default
    unaffected when the flag is omitted, both rejection cases
  • Manually verified end-to-end against a real step binary and real
    certificates, confirming the friendly name via openssl pkcs12 -info

step certificate p12 hardcoded the trust-store friendly name to
'<subject> - <fingerprint>', with no way to override it (unlike
openssl pkcs12's -name option).

Adds --friendly-name to override this default. Scoped to the
trust-store case (--ca only, no cert/key) and to exactly one
certificate: the underlying go-pkcs12 library's Encoder.Encode()
(used for the cert+key identity-store case) doesn't expose a
friendly-name parameter at all, and applying one name to multiple
certificates isn't well-defined. Both cases now fail with a clear
error instead of being silently ignored.

Verified manually end-to-end (real step binary, real openssl-decoded
.p12 output) and covered with unit tests exercising: friendly name
applied correctly, default unaffected when the flag is omitted, and
both rejection cases.

Fixes smallstep#1004
@github-actions github-actions Bot added the needs triage Waiting for discussion / prioritization by team label Aug 23, 2026
@CLAassistant

CLAassistant commented Aug 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

needs triage Waiting for discussion / prioritization by team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the ability to set friendly name when using step certificate p12

3 participants