亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Android Java:試圖讓這個 AES 加密庫工作,但它沒有

Android Java:試圖讓這個 AES 加密庫工作,但它沒有

慕村225694 2022-07-14 17:37:13
我正在嘗試測試這個庫http://blog.cwill-dev.com/2012/10/09/encryption-between-javaandroid-and-php/使用此代碼 ApiCrypter ApiCrypter = new ApiCrypter();@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.activity_my_profile);    try {        String encryptedRequest = ApiCrypter.bytesToHex(this.ApiCrypter.encrypt("hello world"));        Toast.makeText(this, encryptedRequest, Toast.LENGTH_LONG).show();    } catch (Exception e) {        e.printStackTrace();    }在頁面中提到的示例中String encryptedRequest = ApiCrypter.bytesToHex(this.apiCrypter.encrypt(jsonParams.toString()));但是“apiCrypter”不存在所以我使用了實例“ApiCrypter”但是吐司根本沒有被觸發。我試圖在 TextView 中顯示該值,但它也是空的。請問有什么幫助嗎?
查看完整描述

2 回答

?
慕斯709654

TA貢獻1840條經驗 獲得超5個贊

嘗試更換:

ApiCrypter ApiCrypter = new ApiCrypter();

和:

ApiCrypter apiCrypter = new ApiCrypter();

接著:

String encryptedRequest = ApiCrypter.bytesToHex(this.apiCrypter.encrypt(jsonParams.toString()));
查看完整回答
反對 回復 2022-07-14
?
湖上湖

TA貢獻2003條經驗 獲得超2個贊

IV 和 key 都必須是 16 個字符的長度,并且在固定長度后它們更短,它工作正常



查看完整回答
反對 回復 2022-07-14
  • 2 回答
  • 0 關注
  • 124 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號