當前位置: 首頁>>代碼示例>>Golang>>正文


Golang asn1.ObjectIdentifier類代碼示例

本文整理匯總了Golang中github.com/google/certificate-transparency/go/asn1.ObjectIdentifier的典型用法代碼示例。如果您正苦於以下問題:Golang ObjectIdentifier類的具體用法?Golang ObjectIdentifier怎麽用?Golang ObjectIdentifier使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ObjectIdentifier類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: extKeyUsageFromOID

func extKeyUsageFromOID(oid asn1.ObjectIdentifier) (eku ExtKeyUsage, ok bool) {
	for _, pair := range extKeyUsageOIDs {
		if oid.Equal(pair.oid) {
			return pair.extKeyUsage, true
		}
	}
	return
}
開發者ID:juanluisvaladas,項目名稱:origin,代碼行數:8,代碼來源:x509.go

示例2: curveOidToString

func curveOidToString(oid asn1.ObjectIdentifier) (t string, bitlen int) {
	switch {
	case oid.Equal(OidNamedCurveP224):
		return "secp224r1", 224
	case oid.Equal(OidNamedCurveP256):
		return "prime256v1", 256
	case oid.Equal(OidNamedCurveP384):
		return "secp384r1", 384
	case oid.Equal(OidNamedCurveP521):
		return "secp521r1", 521
	}
	return fmt.Sprintf("%v", oid), -1
}
開發者ID:jfrazelle,項目名稱:cfssl,代碼行數:13,代碼來源:x509util.go

示例3: namedCurveFromOID

func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve {
	switch {
	case oid.Equal(oidNamedCurveP224):
		return elliptic.P224()
	case oid.Equal(oidNamedCurveP256):
		return elliptic.P256()
	case oid.Equal(oidNamedCurveP384):
		return elliptic.P384()
	case oid.Equal(oidNamedCurveP521):
		return elliptic.P521()
	}
	return nil
}
開發者ID:CadeLaRen,項目名稱:docker-3,代碼行數:13,代碼來源:x509.go

示例4: getPublicKeyAlgorithmFromOID

func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm {
	switch {
	case oid.Equal(oidPublicKeyRSA):
		return RSA
	case oid.Equal(oidPublicKeyDSA):
		return DSA
	case oid.Equal(oidPublicKeyECDSA):
		return ECDSA
	}
	return UnknownPublicKeyAlgorithm
}
開發者ID:juanluisvaladas,項目名稱:origin,代碼行數:11,代碼來源:x509.go

示例5: OidForStandardExtension

// OidForStandardExtension indicates whether oid identifies a standard extension.
// Standard extensions are listed in RFC 5280 (and other RFCs).
func OidForStandardExtension(oid asn1.ObjectIdentifier) bool {
	if oid.Equal(OidExtensionSubjectKeyId) ||
		oid.Equal(OidExtensionKeyUsage) ||
		oid.Equal(OidExtensionExtendedKeyUsage) ||
		oid.Equal(OidExtensionAuthorityKeyId) ||
		oid.Equal(OidExtensionBasicConstraints) ||
		oid.Equal(OidExtensionSubjectAltName) ||
		oid.Equal(OidExtensionCertificatePolicies) ||
		oid.Equal(OidExtensionNameConstraints) ||
		oid.Equal(OidExtensionCRLDistributionPoints) ||
		oid.Equal(OidExtensionIssuerAltName) ||
		oid.Equal(OidExtensionSubjectDirectoryAttributes) ||
		oid.Equal(OidExtensionInhibitAnyPolicy) ||
		oid.Equal(OidExtensionPolicyConstraints) ||
		oid.Equal(OidExtensionPolicyMappings) ||
		oid.Equal(OidExtensionFreshestCRL) ||
		oid.Equal(OidExtensionSubjectInfoAccess) ||
		oid.Equal(OidExtensionAuthorityInfoAccess) ||
		oid.Equal(OidExtensionCTPoison) ||
		oid.Equal(OidExtensionCTSCT) {
		return true
	}
	return false
}
開發者ID:jfrazelle,項目名稱:cfssl,代碼行數:26,代碼來源:x509util.go

示例6: attributeOidToString

func attributeOidToString(oid asn1.ObjectIdentifier) string {
	switch {
	case oid.Equal(OidCountry):
		return "Country"
	case oid.Equal(OidOrganization):
		return "Organization"
	case oid.Equal(OidOrganizationalUnit):
		return "OrganizationalUnit"
	case oid.Equal(OidCommonName):
		return "CommonName"
	case oid.Equal(OidSerialNumber):
		return "SerialNumber"
	case oid.Equal(OidLocality):
		return "Locality"
	case oid.Equal(OidProvince):
		return "Province"
	case oid.Equal(OidStreetAddress):
		return "StreetAddress"
	case oid.Equal(OidPostalCode):
		return "PostalCode"
	case oid.Equal(OidPseudonym):
		return "Pseudonym"
	case oid.Equal(OidTitle):
		return "Title"
	case oid.Equal(OidDnQualifier):
		return "DnQualifier"
	case oid.Equal(OidName):
		return "Name"
	case oid.Equal(OidSurname):
		return "Surname"
	case oid.Equal(OidGivenName):
		return "GivenName"
	case oid.Equal(OidInitials):
		return "Initials"
	case oid.Equal(OidGenerationQualifier):
		return "GenerationQualifier"
	default:
		return oid.String()
	}
}
開發者ID:jfrazelle,項目名稱:cfssl,代碼行數:40,代碼來源:x509util.go

示例7: getSignatureAlgorithmFromOID

func getSignatureAlgorithmFromOID(oid asn1.ObjectIdentifier) SignatureAlgorithm {
	switch {
	case oid.Equal(oidSignatureMD2WithRSA):
		return MD2WithRSA
	case oid.Equal(oidSignatureMD5WithRSA):
		return MD5WithRSA
	case oid.Equal(oidSignatureSHA1WithRSA):
		return SHA1WithRSA
	case oid.Equal(oidSignatureSHA256WithRSA):
		return SHA256WithRSA
	case oid.Equal(oidSignatureSHA384WithRSA):
		return SHA384WithRSA
	case oid.Equal(oidSignatureSHA512WithRSA):
		return SHA512WithRSA
	case oid.Equal(oidSignatureDSAWithSHA1):
		return DSAWithSHA1
	case oid.Equal(oidSignatureDSAWithSHA256):
		return DSAWithSHA256
	case oid.Equal(oidSignatureECDSAWithSHA1):
		return ECDSAWithSHA1
	case oid.Equal(oidSignatureECDSAWithSHA256):
		return ECDSAWithSHA256
	case oid.Equal(oidSignatureECDSAWithSHA384):
		return ECDSAWithSHA384
	case oid.Equal(oidSignatureECDSAWithSHA512):
		return ECDSAWithSHA512
	}
	return UnknownSignatureAlgorithm
}
開發者ID:juanluisvaladas,項目名稱:origin,代碼行數:29,代碼來源:x509.go


注:本文中的github.com/google/certificate-transparency/go/asn1.ObjectIdentifier類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。