忍耐能抚慰所有的不幸。——维吉尔

加密方式,文档:

https://doc.shengwang.cn/api-ref/rtm2/android/toc-configuration/configuration#RtmEncryptionConfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
    @Bean
public RtmClient rtmClient() throws Exception {
RtmEncryptionConfig rtmEncryptionConfig = new RtmEncryptionConfig();
rtmEncryptionConfig.setEncryptionMode(RtmConstants.RtmEncryptionMode.AES_256_GCM);
rtmEncryptionConfig.setEncryptionKey(agoraProperties.getEncryptionKey());
rtmEncryptionConfig.setEncryptionSalt(agoraProperties.getEncryptionKdfSalt().getBytes(StandardCharsets.UTF_8));
RtmConfig rtmConfig = new RtmConfig.Builder(agoraProperties.getAppId(), RoomConst.SERVER_ID.toString())
.eventListener(agoraRtmClientListener)
.encryptionConfig(rtmEncryptionConfig)
.build();
var mRtmClient = RtmClient.create(rtmConfig);
mRtmClient.login(AgoraUtil.generateRtmToken(), AgoraUtil.resultCallback("login"));
return mRtmClient;
}

这里需要客户端和服务端都配置加密才可以