调试公钥本地储存
This commit is contained in:
parent
dfc5dc433f
commit
d91f59db48
@ -2,6 +2,7 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:star_lock/blue/sm4Encipher/sm4.dart';
|
import 'package:star_lock/blue/sm4Encipher/sm4.dart';
|
||||||
|
|
||||||
|
import '../../tools/storage.dart';
|
||||||
import '../io_tool/io_tool.dart';
|
import '../io_tool/io_tool.dart';
|
||||||
import 'io_reply.dart';
|
import 'io_reply.dart';
|
||||||
import 'io_sender.dart';
|
import 'io_sender.dart';
|
||||||
@ -86,14 +87,17 @@ class GetPrivateKeyCommand extends SenderProtocol {
|
|||||||
authCodeData.add((d1 & 0xff00) >> 8);
|
authCodeData.add((d1 & 0xff00) >> 8);
|
||||||
authCodeData.add((d1 & 0xff));
|
authCodeData.add((d1 & 0xff));
|
||||||
|
|
||||||
// String pubKey = "";
|
List<int> getIntList;
|
||||||
// Storage.getData("bluePublicKey").then((res) => {
|
Storage.getStringList("bluePublicKey").then((res) {
|
||||||
// pubKey = res
|
print("getStrList:$res");
|
||||||
// });
|
getIntList = changeStringListToIntList(res!);
|
||||||
// var pubKey = "ovOvAHuL5+dBCw7L3Qt7IQ==";
|
print("getIntList:$getIntList");
|
||||||
// print("pubKey:$pubKey");
|
});
|
||||||
// List<int> pubKeyData = base64.decode(pubKey.toString());
|
|
||||||
// print("pubKeyData:$pubKeyData");
|
// List<String> getStrList = Storage.getLocalStorage("bluePublicKey") as List<String>;
|
||||||
|
// List<int> getIntList = changeStringListToIntList(getStrList);
|
||||||
|
|
||||||
|
// print("getIntList:$getIntList");
|
||||||
authCodeData.addAll(publicKeyData!);
|
authCodeData.addAll(publicKeyData!);
|
||||||
|
|
||||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||||
|
|||||||
@ -50,7 +50,11 @@ class GetPublicKeyReply extends Reply {
|
|||||||
String stringEncoded = base64.encode(tokenData);
|
String stringEncoded = base64.encode(tokenData);
|
||||||
print('获取公钥成功 publickey:$stringEncoded');
|
print('获取公钥成功 publickey:$stringEncoded');
|
||||||
// 储存公钥
|
// 储存公钥
|
||||||
// Storage.setData("bluePublicKey", stringEncoded);
|
var saveStrList = changeIntListToStringList(tokenData);
|
||||||
|
// Storage.setStringList("bluePublicKey", saveStrList);
|
||||||
|
Storage.setStringList("bluePublicKey", saveStrList);
|
||||||
|
// List<String> getStrList = Storage.getLocalStorage("bluePublicKey") as List<String>;
|
||||||
|
// print('获取储存的公钥 getStrList:$getStrList');
|
||||||
IoSenderManage.getPrivateKey("TMH_c3570480da8d", "1", "1", 1, tokenData, 1);
|
IoSenderManage.getPrivateKey("TMH_c3570480da8d", "1", "1", 1, tokenData, 1);
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
|
|||||||
@ -5,6 +5,19 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
|
|
||||||
class Storage{
|
class Storage{
|
||||||
|
|
||||||
|
// Storage._internal();
|
||||||
|
//
|
||||||
|
// factory Storage() => _instance;
|
||||||
|
//
|
||||||
|
// static late final Storage _instance = Storage._internal();
|
||||||
|
//
|
||||||
|
// static late SharedPreferences _preferences;
|
||||||
|
//
|
||||||
|
// static Future<Storage> getInstance() async {
|
||||||
|
// _preferences = await SharedPreferences.getInstance();
|
||||||
|
// return _instance;
|
||||||
|
// }
|
||||||
|
|
||||||
// ///存数据
|
// ///存数据
|
||||||
// static Future<void> setData(key, value) async {
|
// static Future<void> setData(key, value) async {
|
||||||
// SharedPreferences sp = await SharedPreferences.getInstance();
|
// SharedPreferences sp = await SharedPreferences.getInstance();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user