Source file src/crypto/x509/x509_string.go

     1  // Code generated by "stringer -linecomment -type=KeyUsage,ExtKeyUsage -output=x509_string.go"; DO NOT EDIT.
     2  
     3  package x509
     4  
     5  import "strconv"
     6  
     7  func _() {
     8  	// An "invalid array index" compiler error signifies that the constant values have changed.
     9  	// Re-run the stringer command to generate them again.
    10  	var x [1]struct{}
    11  	_ = x[KeyUsageDigitalSignature-1]
    12  	_ = x[KeyUsageContentCommitment-2]
    13  	_ = x[KeyUsageKeyEncipherment-4]
    14  	_ = x[KeyUsageDataEncipherment-8]
    15  	_ = x[KeyUsageKeyAgreement-16]
    16  	_ = x[KeyUsageCertSign-32]
    17  	_ = x[KeyUsageCRLSign-64]
    18  	_ = x[KeyUsageEncipherOnly-128]
    19  	_ = x[KeyUsageDecipherOnly-256]
    20  }
    21  
    22  const (
    23  	_KeyUsage_name_0 = "digitalSignaturecontentCommitment"
    24  	_KeyUsage_name_1 = "keyEncipherment"
    25  	_KeyUsage_name_2 = "dataEncipherment"
    26  	_KeyUsage_name_3 = "keyAgreement"
    27  	_KeyUsage_name_4 = "keyCertSign"
    28  	_KeyUsage_name_5 = "cRLSign"
    29  	_KeyUsage_name_6 = "encipherOnly"
    30  	_KeyUsage_name_7 = "decipherOnly"
    31  )
    32  
    33  var (
    34  	_KeyUsage_index_0 = [...]uint8{0, 16, 33}
    35  )
    36  
    37  func (i KeyUsage) String() string {
    38  	switch {
    39  	case 1 <= i && i <= 2:
    40  		i -= 1
    41  		return _KeyUsage_name_0[_KeyUsage_index_0[i]:_KeyUsage_index_0[i+1]]
    42  	case i == 4:
    43  		return _KeyUsage_name_1
    44  	case i == 8:
    45  		return _KeyUsage_name_2
    46  	case i == 16:
    47  		return _KeyUsage_name_3
    48  	case i == 32:
    49  		return _KeyUsage_name_4
    50  	case i == 64:
    51  		return _KeyUsage_name_5
    52  	case i == 128:
    53  		return _KeyUsage_name_6
    54  	case i == 256:
    55  		return _KeyUsage_name_7
    56  	default:
    57  		return "KeyUsage(" + strconv.FormatInt(int64(i), 10) + ")"
    58  	}
    59  }
    60  func _() {
    61  	// An "invalid array index" compiler error signifies that the constant values have changed.
    62  	// Re-run the stringer command to generate them again.
    63  	var x [1]struct{}
    64  	_ = x[ExtKeyUsageAny-0]
    65  	_ = x[ExtKeyUsageServerAuth-1]
    66  	_ = x[ExtKeyUsageClientAuth-2]
    67  	_ = x[ExtKeyUsageCodeSigning-3]
    68  	_ = x[ExtKeyUsageEmailProtection-4]
    69  	_ = x[ExtKeyUsageIPSECEndSystem-5]
    70  	_ = x[ExtKeyUsageIPSECTunnel-6]
    71  	_ = x[ExtKeyUsageIPSECUser-7]
    72  	_ = x[ExtKeyUsageTimeStamping-8]
    73  	_ = x[ExtKeyUsageOCSPSigning-9]
    74  	_ = x[ExtKeyUsageMicrosoftServerGatedCrypto-10]
    75  	_ = x[ExtKeyUsageNetscapeServerGatedCrypto-11]
    76  	_ = x[ExtKeyUsageMicrosoftCommercialCodeSigning-12]
    77  	_ = x[ExtKeyUsageMicrosoftKernelCodeSigning-13]
    78  }
    79  
    80  const _ExtKeyUsage_name = "anyExtendedKeyUsageserverAuthclientAuthcodeSigningemailProtectionipsecEndSystemipsecTunnelipsecUsertimeStampingOCSPSigningmsSGCnsSGCmsCodeCommsKernelCode"
    81  
    82  var _ExtKeyUsage_index = [...]uint8{0, 19, 29, 39, 50, 65, 79, 90, 99, 111, 122, 127, 132, 141, 153}
    83  
    84  func (i ExtKeyUsage) String() string {
    85  	idx := int(i) - 0
    86  	if i < 0 || idx >= len(_ExtKeyUsage_index)-1 {
    87  		return "ExtKeyUsage(" + strconv.FormatInt(int64(i), 10) + ")"
    88  	}
    89  	return _ExtKeyUsage_name[_ExtKeyUsage_index[idx]:_ExtKeyUsage_index[idx+1]]
    90  }
    91  

View as plain text