asn1 go(客户端证书身份验证)

I am trying to get client side cert auth working and after reading https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen I realised I needed to parse some asn1.

The structure I'm trying to use is this:

type PublicKeyAndChallenge struct {
    Spki asn1.BitString
    Challenge asn1.BitString
}

type SignedPublicKeyAndChallenge struct{
    PublicKeyAndChallenge PublicKeyAndChallenge
    SignitureAlgorithm  asn1.BitString
    Signiture asn1.BitString
}

I decode the base64 encoded asn1 into a []byte, then I try to unmarshal the asn1 into the structure.

signeeKeySigned := make([]byte, 2048)
    _ , err = base64.StdEncoding.Decode(signeeKeySigned, signeePubKeySigned)
    if ( err != nil ){
        log.Fatal(err)
    }   
    //Parse should be asn.1 encoded
    var signee SignedPublicKeyAndChallenge
    _, err = asn1.Unmarshal(signeeKeySigned, &signee)
    if err != nil {
        log.Fatal(err)
    }  

I am getting a structure error so I believe my structure in go must not be correct, but I am not able to figure it out.

I did some duck duck going and found the rfc320 that provides the definitions of the asn.1 classes and have got it to work!

The structure is now:

type SubjectPublicKeyInfo struct {
    Algorithm pkix.AlgorithmIdentifier
    SubjectPublicKey asn1.BitString
}

type PublicKeyAndChallenge struct {
    Spki SubjectPublicKeyInfo
    Challenge string
}

type SignedPublicKeyAndChallenge struct{
    PublicKeyAndChallenge PublicKeyAndChallenge
    SignitureAlgorithm pkix.AlgorithmIdentifier
    Signiture asn1.BitString
}