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
+3.7k Golang : Switch Redis database redis.NewClient
+16.3k Golang : convert string or integer to big.Int type
+8.2k How to show different content from website server when AdBlock is detected?
+8.9k Golang : Gaussian blur on image and camera video feed examples
+19.6k Golang : Set or Add HTTP Request Headers
+15.8k Golang : How to login and logout with JWT example
+14.6k Golang : Reset buffer example
+5.6k Fix fatal error: evacuation not done in time problem
+8.9k Golang : What is the default port number for connecting to MySQL/MariaDB database ?
+10.9k Golang : Get UDP client IP address and differentiate clients by port number
+7.5k Gogland : Single File versus Go Application Run Configurations
+12.8k Swift : Convert (cast) Int or int32 value to CGFloat