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
+9.3k Golang : How to use Gorilla webtoolkit context package properly
+16.6k Golang : convert string or integer to big.Int type
+11.9k Golang : Concurrency and goroutine example
+5.5k PHP : Hide PHP version information from curl
+24.3k Golang : Find biggest/largest number in array
+4.5k Golang : Converting individual Jawi alphabet to Rumi(Romanized) alphabet example
+17k Golang : Get own process identifier
+6.1k Golang : Detect variable or constant type
+20.5k Golang : Compare floating-point numbers
+7.1k Golang : Muxing with Martini example
+9.9k Golang : Populate slice with sequential integers example