Skip to content

crypto/x509: add String() for KeyUsage, ExtKeyUsage #56005

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/next/56866.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pkg crypto/x509, type KeyUsage int, String() string #56866
pkg crypto/x509, type ExtKeyUsage int, String() string #56866
38 changes: 38 additions & 0 deletions src/crypto/x509/extkeyusage_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions src/crypto/x509/keyusage_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/crypto/x509/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ func oidFromECDHCurve(curve ecdh.Curve) (asn1.ObjectIdentifier, bool) {
return nil, false
}

//go:generate stringer -type=KeyUsage -trimprefix KeyUsage

// KeyUsage represents the set of actions that are valid for a given key. It's
// a bitmap of the KeyUsage* constants.
type KeyUsage int
Expand Down Expand Up @@ -613,6 +615,8 @@ var (
oidExtKeyUsageMicrosoftKernelCodeSigning = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 311, 61, 1, 1}
)

//go:generate stringer -type=ExtKeyUsage -trimprefix ExtKeyUsage

// ExtKeyUsage represents an extended set of actions that are valid for a given key.
// Each of the ExtKeyUsage* constants define a unique action.
type ExtKeyUsage int
Expand Down