本文整理匯總了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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()
}
}
示例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
}