无法在Golang中为ASN解码定义正确的结构

I have the following ASN1 structure to decode using golang

SEQUENCE(2 elem)
     SEQUENCE(2 elem)
          OBJECT IDENTIFIER1.2.840.113549.1.1.1
          NULL
     BIT STRING(1 elem)
          SEQUENCE(2 elem)
               INTEGER(2048 bit) 20832…
               INTEGER  65537

and I am using the following struct to store the decoded data:

type OidAndNullSET struct {
    OID  asn1.ObjectIdentifier
    Null asn1.RawValue
}

type Seq struct {
    Set    OidAndNullSET
    BitStr asn1.BitString
}

func main() {
    mdata2 := []byte("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhxW+fVIU3KiVWyHy5RZ6jMQrXbrpUNOrz8V29qhZ98G53o6yKeUc2dOXC/dX2w8lEXjf+Hys9BLAJJZc6dlV1vrVZM5C9fvCAMHlAcMW2AADLuG+SruM6URBedSAxMFVwAzsSApLEQSlfGyMvjT+UOrHEjBUMn4+IPiLW2G0o1pHxCkrUxub/RWpl5qO7BbuEQj4flbUGpOpFW+XOuYu78MRmEvl/E9SX8b04RrXZTxPMAqxAl/zRA7VgIVzwtcm6xjzFw8kvr7H4B/zb7Jvl32FhniXMOrPfSGI2xhrr92DTOaPXuPFH2DywbNj/O21fenykWYsB/bA8vH7/EmQdwIDAQAB")


    var n Seq
    _, err1 := asn1.Unmarshal(mdata2, &n)
    checkError(err1)

    fmt.Println("After unmarshal: ", n)
}

func checkError(err error) {
    if err != nil {
        fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error())
        os.Exit(1)
    }
}

I cannot find a proper structure to store a SEQUENCE* and getting following error

asn1: structure error: tags don't match (16 vs {class:1 tag:13 length:73 isCompound:false}).

Any thoughts?

You defined base64-encoded ASN.1 stream and need to decode it before passing to Unmarshal. Consider the next definition:

mdata2, _ := base64.StdEncoding.DecodeString("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhxW+fVIU3KiVWyHy5RZ6jMQrXbrpUNOrz8V29qhZ98G53o6yKeUc2dOXC/dX2w8lEXjf+Hys9BLAJJZc6dlV1vrVZM5C9fvCAMHlAcMW2AADLuG+SruM6URBedSAxMFVwAzsSApLEQSlfGyMvjT+UOrHEjBUMn4+IPiLW2G0o1pHxCkrUxub/RWpl5qO7BbuEQj4flbUGpOpFW+XOuYu78MRmEvl/E9SX8b04RrXZTxPMAqxAl/zRA7VgIVzwtcm6xjzFw8kvr7H4B/zb7Jvl32FhniXMOrPfSGI2xhrr92DTOaPXuPFH2DywbNj/O21fenykWYsB/bA8vH7/EmQdwIDAQAB")

Then it should work after adding "encoding/base64" to imports.