Golang encoding/asn1.ObjectIdentifier type, Equal and String inner functions example
package encoding/asn1
An ObjectIdentifier represents an ASN.1 OBJECT IDENTIFIER.
Equal reports whether oi and other represent the same identifier.
Golang encoding/asn1.ObjectIdentifier type, Equal and String inner functions usage example ( taken from http://golang.org/src/pkg/crypto/x509/x509.go )
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
}
Reference :
Advertisement
Something interesting
Tutorials
+12.3k Golang : How to check if a string starts or ends with certain characters or words?
+37.7k Golang : Comparing date or timestamp
+7.6k Golang : Set horizontal, vertical scroll bars policies and disable interaction on Qt image
+9.4k Golang : Terminate-stay-resident or daemonize your program?
+10.9k Nginx : TLS 1.2 support
+12.4k Golang : Encrypt and decrypt data with x509 crypto
+7.1k Nginx : How to block user agent ?
+8k Golang : Handle Palindrome string with case sensitivity and unicode
+80.6k Golang : How to return HTTP status code?
+6.2k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+7.6k Golang : Convert(cast) io.Reader type to string
+12.2k Golang : Get remaining text such as id or filename after last segment in URL path