输入字节2564处的错误base64数据错误消息

I am getting:

error: illegal base64 data at input byte 2564 

When I am decrypting two encoded strings:

data1:="8uxiowaHGmt6usI7U2SErXwpi/JLKbdhI3o...."(encrypted data)
data2:="iqqtWBCW7Ih9GAXubtIoLjucdIDfWd+oo2j...."(encrypted data)

data:=data1+data2

value, err = base64.StdEncoding.DecodeString(data)
if err != nil {
    log.Println(err)
    return
}

Can anyone suggest what could be the problem?

You can't concatenate different base64 encoded strings and decode them as one. Base64 encoding might not use all the bits in the result string, and it may use padding, which is only valid if found at the end (but not in the middle).

You have to decode them separately.

See this example:

d1 := []byte{1, 2}
d2 := []byte{3, 4}
s1 := base64.StdEncoding.EncodeToString(d1)
s2 := base64.StdEncoding.EncodeToString(d2)
fmt.Println(s1)
fmt.Println(s2)

d1d, err := base64.StdEncoding.DecodeString(s1)
if err != nil {
    panic(err)
}
d2d, err := base64.StdEncoding.DecodeString(s2)
if err != nil {
    panic(err)
}
fmt.Println(d1d)
fmt.Println(d2d)

d12d, err := base64.StdEncoding.DecodeString(s1 + s2)
if err != nil {
    fmt.Println(err)
} else {
    fmt.Println(d12d)
}

Output (try it on the Go Playground):

AQI=
AwQ=
[1 2]
[3 4]
illegal base64 data at input byte 4

As you can see, decoding succeeds one-by-one, but fails when attempting to decode the concatenated string.

Note:

Note that in special cases it might be possible to "properly" decode concatenated base64 strings (that is, if the first one does not end with padding characters), but you should never make such assumption.

For example if the first data is the encoded from of an input whose length is dividable by 3, its Base64 form does not contain padding:

d1 := []byte{1, 2, 3}
d2 := []byte{4, 5, 6}

Using this input to the above test code, it yields success (try it on the Go Playground):

AQID
BAUG
[1 2 3]
[4 5 6]
[1 2 3 4 5 6]

I ran into a somewhat similar issue; the solution for me was to use base64.RawStdEncoding, since my encoded string had already had its padding stripped.

Note: As the other answer mentions, if padding has not been stripped: you can not concatenate two base64encoded strings.

From the docs:

RawStdEncoding is the standard raw, unpadded base64 encoding, as defined in RFC 4648 section 3.2. This is the same as StdEncoding but omits padding characters.

var RawStdEncoding = StdEncoding.WithPadding(NoPadding)

RawURLEncoding is the unpadded alternate base64 encoding defined in RFC 4648. It is typically used in URLs and file names. This is the same as URLEncoding but omits padding characters.

var RawURLEncoding = URLEncoding.WithPadding(NoPadding)

StdEncoding is the standard base64 encoding, as defined in RFC 4648.

var StdEncoding = NewEncoding(encodeStd)

URLEncoding is the alternate base64 encoding defined in RFC 4648. It is typically used in URLs and file names.

var URLEncoding = NewEncoding(encodeURL)