func GetURINamesFromPEM(encodedCertificate string) (uris []string, err error) {
	return uriNamesFromPEM([]byte(encodedCertificate))
}
GetURINamesFromPEM parses a PEM-encoded X.509 certificate and gets the URIs from the SAN extension.
package uri
import (
	"crypto/x509"
	"crypto/x509/pkix"
	"encoding/asn1"
	"encoding/pem"
	"errors"
	"io"
	"io/ioutil"
)
func getURINamesFromSANExtension(sanExtension []byte) (uris []string, err error) {
	var seq asn1.RawValue
	var rest []byte
	if rest, err = asn1.Unmarshal(sanExtension, &seq); err != nil {
		return uris, err
	} else if len(rest) != 0 {
		err = errors.New("x509: trailing data after X.509 extension")
		return uris, err
	}
	if !seq.IsCompound || seq.Tag != 16 || seq.Class != 0 {
		err = asn1.StructuralError{Msg: "bad SAN sequence"}
		return uris, err
	}
	rest = seq.Bytes
	for len(rest) > 0 {
		var v asn1.RawValue
		rest, err = asn1.Unmarshal(rest, &v)
		if err != nil {
			return uris, err
		}
		if v.Tag == 6 {
			uris = append(uris, string(v.Bytes))
		}
	}
	return uris, err
}
func GetURINamesFromCertificate(cert *x509.Certificate) (uris []string, err error) {
	for _, ext := range GetExtensionsFromAsn1ObjectIdentifier(cert, OidExtensionSubjectAltName) {
		uris, err = getURINamesFromSANExtension(ext.Value)
		if err != nil {
			return uris, err
		}
	}
	return uris, nil
}