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
+7.1k Javascript : How to get JSON data from another website with JQuery or Ajax ?
+7.5k Gogland : Single File versus Go Application Run Configurations
+27.9k Golang : Decode/unmarshal unknown JSON data type with map[string]interface
+7.9k Golang Hello World Example
+9.6k Golang : Quadratic example
+5.3k Golang : Pad file extension automagically
+4.3k Javascript : How to show different content with noscript?
+21.5k Golang : How to read float value from standard input ?
+6k Linux/MacOSX : Search for files by filename and extension with find command
+12.6k Golang : Get absolute path to binary for os.Exec function with exec.LookPath
+12.6k Golang : flag provided but not defined error
+23.9k Golang : Use regular expression to validate domain name