code: func IsRsaPublicKey(str string, keylen int) bool {
  	bb := bytes.NewBufferString(str)
  	pemBytes, err := ioutil.ReadAll(bb)
  	if err != nil {
  		return false
  	}
  	block, _ := pem.Decode(pemBytes)
  	if block != nil && block.Type != "PUBLIC KEY" {
  		return false
  	}
  	var der []byte
  
  	if block != nil {
  		der = block.Bytes
  	} else {
  		der, err = base64.StdEncoding.DecodeString(str)
  		if err != nil {
  			return false
  		}
  	}
  
  	key, err := x509.ParsePKIXPublicKey(der)
  	if err != nil {
  		return false
  	}
  	pubkey, ok := key.(*rsa.PublicKey)
  	if !ok {
  		return false
  	}
  	bitlen := len(pubkey.N.Bytes()) * 8
  	return bitlen == int(keylen)
  }
docs: // IsRsaPublicKey check if a string is valid public key with provided length