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
+6.3k PHP : How to handle URI or URL with non-ASCII characters such as Chinese/Japanese/Korean(CJK) ?
+5.2k Golang : Issue HTTP commands to server and port example
+5.4k Golang *File points to a file or directory ?
+11.2k CodeIgniter : How to check if a session exist in PHP?
+17k Golang : How to save log messages to file?
+7.7k Golang : Test if an input is an Armstrong number example
+7.7k Golang : Command line ticker to show work in progress
+8.1k Golang : How To Use Panic and Recover
+17.3k Golang : How to tell if a file is compressed either gzip or zip ?
+7.1k Golang : Array mapping with Interface
+17.6k Golang : Parse date string and convert to dd-mm-yyyy format
+11.3k Golang : Intercept and process UNIX signals example