Java: Different results when decoding base64 string with java.util.Base64 vs android.util.Base64

前端 未结 2 586
花落未央
花落未央 2020-12-05 17:50

I\'m working on a client/server system and I\'m trying to do some basic encryption. When I connect to the server, I send a public key as an escaped string across the socket.

2条回答
  •  一生所求
    2020-12-05 18:16

    On android, Use Base64.NO_WRAP instead of Base64.DEFAULT

    @Override
    protected String encode(byte[] bytes) {
        return Base64.encodeToString(bytes, Base64.NO_WRAP);
    }
    

提交回复
热议问题