Open puckyeh opened 5 years ago
ok. I will publish a new version which support aes ccm and gcm net week.
我会在下周发一个新版本支持AES ccm和gcm。
@puckyeh hi, i published a new version to support GCM for android.
Could u help to test it on android?
if no problem I will implement the ios part
新版本支持android平台gcm加解密。可以帮测试下。 没有什么问题的话,我就开始实现ios系统支持了。
android gcm 加解密 測試看起來沒問題!!
麻烦多做些测试,我正在实现ios部分
puckyeh notifications@github.com于2019年1月31日 周四21:23写道:
android gcm 加解密 測試看起來沒問題!!
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/shyandsy/cipher2/issues/2#issuecomment-459592151, or mute the thread https://github.com/notifications/unsubscribe-auth/AFBvoTEqjXuHHRXf5FuCZhTp_J-04Slyks5vI7NLgaJpZM4aZedl .
-- Yang Shi 201-15 bridgeland dr south R3Y 0E7
我自行用 php 試著做 aes-128-gcm 的加解密 和你轉出來的結果好像不同耶!!
$plaintext = ('{\"token\":\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",\"device\":\"AABBCCDD\"}'); $key = '8c775176c699f9cd'; $iv = '0000000756632532'; $cipher = "aes-128-gcm";
php 轉出來的結果是 yAChpzwcQ89E7IqvzBNU7Ty5evziE29hLn1VtYqTWUqewxD7jCY0Au2OeovyUlsB7wFTOVk97Q3rZKKMEvl3Je1j
用你的 lib 轉出來的結果是 YnT2s2JmGMXGgT12BT9pn5S6+nf/2A6KejUdyy7Yhq30HrLL2c/B6acdjgazJCQ1ngjuFHr6Zu5eXGGnb3WGN1s2lCs9WFjQje0=
@puckyeh
明白你的问题了,我需要修改一下秘钥参数格式。兼容更多的表示方式
@puckyeh 可以贴一下你的php加密代码么
加密 $ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag); 解密 $original_plaintext = openssl_decrypt($ciphertext, $cipher, $key, $options=0, $iv, $tag);
@puckyeh
麻烦贴完整可运行代码,不要让我猜参数,整理你的代码。
不好意思, 當時想貼完整的, 但都是亂碼, 就沒想那麼多了, 我重新貼!! $tag 預設就是 null
$plaintext = ('{\"token\":\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",\"device\":\"AABBCCDD\"}'); $key = '8c775176c699f9cd'; $iv = '0000000756632532'; $cipher = "aes-128-gcm"; $tag = null; if (in_array($cipher, openssl_get_cipher_methods())) { $ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag); echo $ciphertext; $original_plaintext = openssl_decrypt($ciphertext, $cipher, $key, $options=0, $iv, $tag); echo $original_plaintext; }
我剛剛才發現, 你的 nonce 有做過 base64 的編碼 所以我在 php 上的 $iv 也補做了 base64, 編碼出來的結果看起來對一半, 貼給你看看, 希望對你有幫助!!
以下為參數 : $plaintext = '{"badgeCount":"3"}'; $key = '8c775176c699f9cd'; $iv = '0000000756632532';
php 的編碼結果 "pVlKqNVeHv06aENl2nau/n4M"
cipher2 的編碼結果 "pVlKqNVeHv06aENl2nau/n4M8G2uIl7vt0BFM7uFTtQb0Q==\n"
最近特别忙 等我缓口气再来解决这个问题 抱歉久等了
puckyeh notifications@github.com于2019年2月13日 周三09:17写道:
我剛剛才發現, 你的 nonce 有做過 base64 的編碼 所以我在 php 上的 $iv 也補做了 base64, 編碼出來的結果看起來對一半, 貼給你看看, 希望對你有幫助!!
以下為參數 : $plaintext = '{"badgeCount":"3"}'; $key = '8c775176c699f9cd'; $iv = '0000000756632532';
php 的編碼結果 "pVlKqNVeHv06aENl2nau/n4M"
cipher2 的編碼結果 "pVlKqNVeHv06aENl2nau/n4M8G2uIl7vt0BFM7uFTtQb0Q==\n"
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/shyandsy/cipher2/issues/2#issuecomment-463237505, or mute the thread https://github.com/notifications/unsubscribe-auth/AFBvobOBiumhoN04uqSMl2uPJOgEVFVaks5vNCx9gaJpZM4aZedl .
-- Yang Shi 201-15 bridgeland dr south R3Y 0E7
我使用了你所提供的 cipher2 0.2.1這個 flutter plugin , 非常簡易好用!! 目前我需要 AES-CCM 及 AES-GCM 來做加密解密, 想請問一下, 你能夠提供並升級此插件嗎?