Standard library / crypto/x509

crypto/x509.KeyUsage

Bit mask for permitted key operations. Combine flags with |; inspect using &. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
type KeyUsage int

Working Example

Example Snippetgo
package main
import (  "crypto/x509"  "fmt")
func main() {  u := x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign  fmt.Println(u&x509.KeyUsageCertSign != 0)}
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference