diff --git a/dsoftbus/extended_auth/Client/parameter.h b/dsoftbus/extended_auth/Client/parameter.h new file mode 100644 index 0000000000000000000000000000000000000000..e4fb8a17b4ffdf9f5577528104a46f296cb311b1 --- /dev/null +++ b/dsoftbus/extended_auth/Client/parameter.h @@ -0,0 +1,21 @@ +#ifndef SYSPARA_PARAMETER_H +#define SYSPARA_PARAMETER_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* __cplusplus */ + + int GetDevUdid(char *udid, int size); + + char * GetDeviceType(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* __cplusplus */ + +#endif /* SYSPARA_PARAMETER_H */ + diff --git a/dsoftbus/extended_auth/Client/softbus_client_main.c b/dsoftbus/extended_auth/Client/softbus_client_main.c new file mode 100644 index 0000000000000000000000000000000000000000..e16749b7fcf2f0e1c892cd022563be4f72ffb996 --- /dev/null +++ b/dsoftbus/extended_auth/Client/softbus_client_main.c @@ -0,0 +1,811 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "parameter.h" +#include "softbus_bus_center.h" +#define APP_ID "hichain_test" +#define SESSION_NAME "com.huawei.devicegroupmanage.test" +#define DEFAULT_CAPABILITY "osdCapability" +#define PUBLISH_ID 100 + +#define DEFAULT_GROUP_NAME "dsoftbus" +#define DEFAULT_PIN_CODE "123456" +#define MAX_UDID_LEN 65 +#define MAX_GROUP_LEN 65 +#define ERR_RET -1 + +#define FIELD_ETH_IP "ETH_IP" +#define FIELD_ETH_PORT "ETH_PORT" +#define FIELD_WLAN_IP "WIFI_IP" +#define FIELD_WLAN_PORT "WIFI_PORT" + +enum { + DEVICE_DISCOVERY = 0, + DEVICE_JOINING, + DEVICE_ONLINE, +}DeviceStatus; + +char* g_deviceStatus[] = { + "discovery", + "joining", + "online", +}; + +typedef struct DeviceList { + struct DeviceList* next; + DeviceInfo device; + int status; + int64_t requestId; +} DeviceList; +DeviceList* g_deviceListHead = NULL; + +static const DeviceGroupManager* g_hichainGmInstance = NULL; +static char g_udid[MAX_UDID_LEN]; +static char g_groupId[MAX_GROUP_LEN]; +static int64_t g_requestId = 1; +static int g_sessionId; +bool pinFlag = true; + +static int SessionOpened(int sessionId, int result) +{ + printf("CB: session %d open fail:%d\n", sessionId, result); + if (result == 0) { + g_sessionId = sessionId; + } + + return result; +} + +static void SessionClosed(int sessionId) +{ + printf("CB: session %d closed\n", sessionId); +} + +static void ByteRecived(int sessionId, const void* data, unsigned int dataLen) +{ + printf("CB: session %d received %u bytes data=%s\n", sessionId, dataLen, (const char*)data); +} + +static void MessageReceived(int sessionId, const void* data, unsigned int dataLen) +{ + printf("CB: session %d received %u bytes message=%s\n", sessionId, dataLen, (const char*)data); +} + +static int CreateSessionServerInterface(void) +{ + const ISessionListener sessionCB = { + .OnSessionOpened = SessionOpened, + .OnSessionClosed = SessionClosed, + .OnBytesReceived = ByteRecived, + .OnMessageReceived = MessageReceived, + }; + + return CreateSessionServer(APP_ID, SESSION_NAME, &sessionCB); +} + +static const char* GetStringFromJson(const cJSON* obj, const char* key) +{ + cJSON* item; + + if (obj == NULL || key == NULL) + return NULL; + + item = cJSON_GetObjectItemCaseSensitive(obj, key); + if (item != NULL && cJSON_IsString(item)) { + return cJSON_GetStringValue(item); + } + else { + int len = cJSON_GetArraySize(obj); + for (int i = 0; i < len; i++) { + item = cJSON_GetArrayItem(obj, i); + if (cJSON_IsObject(item)) { + const char* value = GetStringFromJson(item, key); + if (value != NULL) + return value; + } + } + } + return NULL; +} + +static int HichainSaveGroupID(const char* param) +{ + cJSON* msg = cJSON_Parse(param); + const char* value = NULL; + + if (msg == NULL) { + printf("HichainSaveGroupID: cJSON_Parse fail\n"); + return ERR_RET; + } + + value = GetStringFromJson(msg, FIELD_GROUP_ID); + if (value == NULL) { + printf("HichainSaveGroupID:GetStringFromJson fail\n"); + cJSON_Delete(msg); + return ERR_RET; + } + + memcpy_s(g_groupId, MAX_GROUP_LEN, value, strlen(value)); + printf("HichainSaveGroupID:groupID=%s\n", g_groupId); + + cJSON_Delete(msg); + return 0; +} + +static void HiChainGmOnFinish(int64_t requestId, int operationCode, const char* returnData) +{ + if (operationCode == GROUP_CREATE && returnData != NULL) { + printf("create new group finish:requestId=%lld, returnData=%s\n", requestId, returnData); + HichainSaveGroupID(returnData); + } + else if (operationCode == MEMBER_JOIN) { + DeviceList* node = g_deviceListHead; + + printf("member join finish:requestId=%lld, returnData=%s\n", requestId, returnData); + while (node) { + if (node->requestId != requestId) { + node = node->next; + continue; + } + node->status = DEVICE_ONLINE; + break; + } + } + else { + printf("CB:requestId=%lld, operationCode=%d, returnData=%s\n", requestId, operationCode, returnData); + } +} + +static void HiChainGmOnError(int64_t requestId, int operationCode, int errorCode, const char* errorReturn) +{ + DeviceList* node = g_deviceListHead; + + printf("CB:requestId=%lld, operationCode=%d, errorCode=%d, errorReturn=%s\n", requestId, operationCode, errorCode, errorReturn); + while (node) { + if (node->requestId != requestId) { + node = node->next; + continue; + } + node->status = DEVICE_DISCOVERY; + break; + } +} + +static char* HiChainGmOnRuest(int64_t requestId, int operationCode, const char* reqParams) +{ + cJSON* msg = cJSON_CreateObject(); + char* param = NULL; + + printf("CB:requestId=%lld, operationCode=%d, reqParams=%s", requestId, operationCode, reqParams); + + if (operationCode != MEMBER_JOIN) { + return NULL; + } + + if (msg == NULL) { + printf("HiChainGmOnRuest: cJSON_CreateObject fail\n"); + } + + if (cJSON_AddNumberToObject(msg, FIELD_CONFIRMATION, REQUEST_ACCEPTED) == NULL || + cJSON_AddStringToObject(msg, FIELD_PIN_CODE, pinFlag ? DEFAULT_PIN_CODE : "") == NULL || + cJSON_AddStringToObject(msg, FIELD_DEVICE_ID, g_udid) == NULL) { + printf("HiChainGmOnRuest: cJSON_AddToObject fail\n"); + cJSON_Delete(msg); + return NULL; + } + + param = cJSON_PrintUnformatted(msg); + cJSON_Delete(msg); + return param; +} + +static const DeviceAuthCallback g_groupManagerCallback = { + .onRequest = HiChainGmOnRuest, + .onError = HiChainGmOnError, + .onFinish = HiChainGmOnFinish, +}; + +static int HichainGmRegCallback(void) +{ + return g_hichainGmInstance->regCallback(APP_ID, &g_groupManagerCallback); +} + +static void HichainGmUnRegCallback(void) +{ + g_hichainGmInstance->unRegCallback(APP_ID); +} + +static int HichainGmGetGroupInfo(char** groupVec, uint32_t* num) +{ + cJSON* msg = cJSON_CreateObject(); + char* param = NULL; + int ret = ERR_RET; + + if (msg == NULL) { + printf("HichainGmGetGroupInfo: cJSON_CreateObject fail\n"); + return ret; + } + + if (cJSON_AddNumberToObject(msg, FIELD_GROUP_TYPE, PEER_TO_PEER_GROUP) == NULL || + cJSON_AddStringToObject(msg, FIELD_GROUP_NAME, DEFAULT_GROUP_NAME) == NULL || + cJSON_AddNumberToObject(msg, FIELD_GROUP_VISIBILITY, GROUP_VISIBILITY_PUBLIC) == NULL) { + printf("HichainGmGetGroupInfo: cJSON_AddToObject fail\n"); + goto err_cJSON_Delete; + } + + param = cJSON_PrintUnformatted(msg); + if (param == NULL) { + printf("HichainGmGetGroupInfo: cJSON_PrintUnformatted fail\n"); + goto err_cJSON_Delete; + } + + ret = g_hichainGmInstance->getGroupInfo(ANY_OS_ACCOUNT, APP_ID, param, groupVec, num); + if (ret != 0) { + printf("getGroupInfo fail:%d", ret); + goto err_getGroupInfo; + } + +err_getGroupInfo: + cJSON_free(param); +err_cJSON_Delete: + cJSON_Delete(msg); + return ret; +} + +static void HichainGmDestroyGroupInfo(char** groupVec) +{ + g_hichainGmInstance->destroyInfo(groupVec); +} + +static int HichainGmCreatGroup(void) +{ + cJSON* msg = cJSON_CreateObject(); + char* param = NULL; + int ret = ERR_RET; + + if (msg == NULL) + return ret; + + if (cJSON_AddNumberToObject(msg, FIELD_GROUP_TYPE, PEER_TO_PEER_GROUP) == NULL || + cJSON_AddStringToObject(msg, FIELD_DEVICE_ID, g_udid) == NULL || + cJSON_AddStringToObject(msg, FIELD_GROUP_NAME, DEFAULT_GROUP_NAME) == NULL || + cJSON_AddNumberToObject(msg, FIELD_USER_TYPE, 0) == NULL || + cJSON_AddNumberToObject(msg, FIELD_GROUP_VISIBILITY, GROUP_VISIBILITY_PUBLIC) == NULL || + cJSON_AddNumberToObject(msg, FIELD_EXPIRE_TIME, EXPIRE_TIME_MAX) == NULL) { + printf("HichainGmCreatGroup: cJSON_AddToObject fail\n"); + cJSON_Delete(msg); + return ret; + } + param = cJSON_PrintUnformatted(msg); + if (param == NULL) { + printf("HichainGmCreatGroup: cJSON_PrintUnformatted fail\n"); + cJSON_Delete(msg); + return ret; + } + + ret = g_hichainGmInstance->createGroup(ANY_OS_ACCOUNT, g_requestId++, APP_ID, param); + + cJSON_free(param); + cJSON_Delete(msg); + return ret; +} + +static bool HichainIsDeviceInGroup(const char* groupId, const char* devId) +{ + return g_hichainGmInstance->isDeviceInGroup(ANY_OS_ACCOUNT, APP_ID, groupId, devId); +} + +static int HichainGmAddMemberToGroup(DeviceInfo* device, const char* groupId) +{ + cJSON* msg = cJSON_CreateObject(); + cJSON* addr = NULL; + char* param = NULL; + int ret = ERR_RET; + + if (msg == NULL) { + printf("HichainGmAddMemberToGroup: cJSON_CreateObject1 fail\n"); + return ret; + } + + addr = cJSON_CreateObject(); + if (addr == NULL) { + printf("HichainGmAddMemberToGroup: cJSON_CreateObject2 fail\n"); + goto err_cJSON_CreateObject; + } + + for (unsigned int i = 0; i < device->addrNum; i++) { + if (device->addr[i].type == CONNECTION_ADDR_ETH) { + if (cJSON_AddStringToObject(addr, FIELD_ETH_IP, device->addr[i].info.ip.ip) == NULL || + cJSON_AddNumberToObject(addr, FIELD_ETH_PORT, device->addr[i].info.ip.port) == NULL) { + printf("HichainGmAddMemberToGroup: cJSON_AddToObject1 fail\n"); + goto err_cJSON_AddToObject; + } + } + else if (device->addr[i].type == CONNECTION_ADDR_WLAN) { + if (cJSON_AddStringToObject(addr, FIELD_WLAN_IP, device->addr[i].info.ip.ip) == NULL || + cJSON_AddNumberToObject(addr, FIELD_WLAN_PORT, device->addr[i].info.ip.port) == NULL) { + printf("HichainGmAddMemberToGroup: cJSON_AddToObject2 fail\n"); + goto err_cJSON_AddToObject; + } + } + else { + printf("unsupport connection type:%d\n", device->addr[i].type); + goto err_cJSON_AddToObject; + } + } + + param = cJSON_PrintUnformatted(addr); + if (param == NULL) { + printf("HichainGmAddMemberToGroup: cJSON_PrintUnformatted1 fail\n"); + goto err_cJSON_AddToObject; + } + + if (cJSON_AddStringToObject(msg, FIELD_GROUP_ID, groupId) == NULL || + cJSON_AddNumberToObject(msg, FIELD_GROUP_TYPE, PEER_TO_PEER_GROUP) == NULL || + cJSON_AddStringToObject(msg, FIELD_PIN_CODE, pinFlag ? DEFAULT_PIN_CODE : "") == NULL || + cJSON_AddStringToObject(msg, FIELD_DEVICE_ID, g_udid) == NULL || + cJSON_AddStringToObject(msg, FIELD_GROUP_NAME, DEFAULT_GROUP_NAME) == NULL || + cJSON_AddBoolToObject(msg, FIELD_IS_ADMIN, false) == NULL || + cJSON_AddStringToObject(msg, FIELD_CONNECT_PARAMS, param) == NULL) { + printf("HichainGmAddMemberToGroup: cJSON_AddToObject4 fail\n"); + goto err_cJSON_AddToObject1; + } + + cJSON_free(param); + param = cJSON_PrintUnformatted(msg); + if (param == NULL) { + printf("HichainGmAddMemberToGroup: cJSON_PrintUnformatted fail\n"); + goto err_cJSON_CreateObject; + } + + ret = g_hichainGmInstance->addMemberToGroup(ANY_OS_ACCOUNT, g_requestId++, APP_ID, param); + if (ret != 0) { + printf("addMemberToGroup fail:%d\n", ret); + } + +err_cJSON_AddToObject1: + cJSON_free(param); +err_cJSON_AddToObject: + cJSON_Delete(addr); +err_cJSON_CreateObject: + cJSON_Delete(msg); + return ret; +} + +static int HichainInit(void) +{ + char* groupVec = NULL; + uint32_t num; + int ret; + + ret = InitDeviceAuthService(); + if (ret != 0) { + printf("InitDeviceAuthService fail:%d\n", ret); + return ret; + } + + g_hichainGmInstance = GetGmInstance(); + if (g_hichainGmInstance == NULL) { + printf("GetGmInstance fail\n"); + ret = ERR_RET; + goto err_GetGmInstance; + } + + ret = HichainGmRegCallback(); + if (ret != 0) { + printf("HichainGmregCallback fail.:%d\n", ret); + goto err_HichainGmRegCallback; + } + + ret = HichainGmGetGroupInfo(&groupVec, &num); + if (ret != 0) { + printf("HichainGmGetGroupInfo fail:%d\n", ret); + goto err_HichainGmGetGroupInfo; + } + + if (num == 0) { + ret = HichainGmCreatGroup(); + if (ret) { + printf("HichainGmCreatGroup fail:%d\n", ret); + goto err_HichainGmCreatGroup; + } + } + else { + printf("HichainGmGetGroupInfo:num=%u\n", num); + HichainSaveGroupID(groupVec); + HichainGmDestroyGroupInfo(&groupVec); + } + + return 0; + +err_HichainGmCreatGroup: +err_HichainGmGetGroupInfo: + HichainGmUnRegCallback(); +err_HichainGmRegCallback: +err_GetGmInstance: + DestroyDeviceAuthService(); + return ret; +} + +static void CheckDeviceStatus(void) +{ + DeviceList* node = g_deviceListHead; + char* groupVec = NULL; + uint32_t num; + int ret; + + ret = HichainGmGetGroupInfo(&groupVec, &num); + if (ret != 0 || num == 0) { + printf("HichainGmGetGroupInfo fail\n"); + return; + } + + ret = HichainSaveGroupID(groupVec); + if (ret != 0) + goto err_HichainSaveGroupID; + + while (node) { + if (HichainIsDeviceInGroup(g_groupId, node->device.devId)) { + node->status = DEVICE_ONLINE; + } + node = node->next; + } + +err_HichainSaveGroupID: + HichainGmDestroyGroupInfo(&groupVec); +} + +static bool CheckDeviceExist(const DeviceInfo* device) +{ + DeviceList* node = g_deviceListHead; + + while (node) { + if (strcmp(device->devId, node->device.devId) == 0) { + return true; + } + node = node->next; + } + return false; +} + +static void SaveDeviceInfo(const DeviceInfo* device) +{ + DeviceList* node = malloc(sizeof(DeviceList)); + + if (node == NULL) { + printf("SaveDeviceInfo: malloc fail\n"); + return; + } + + node->device = *device; + node->requestId = ERR_RET; + node->status = DEVICE_DISCOVERY; + if (g_deviceListHead == NULL) { + node->next = NULL; + } + else { + node->next = g_deviceListHead; + } + g_deviceListHead = node; +} + +static DeviceList* GetDeviceInfo(int idx) +{ + DeviceList* node = g_deviceListHead; + while (node) { + if (--idx == 0) { + return node; + } + node = node->next; + } + return NULL; +} + +static void FreeDeviceInfo() +{ + while (g_deviceListHead) { + DeviceList* node = g_deviceListHead->next; + free(g_deviceListHead); + g_deviceListHead = node; + } +} + +static void ListDevice(void) +{ + DeviceList* node = g_deviceListHead; + int input, num = 0; + + if (node == NULL) { + printf("Get no device!\n"); + return; + } + DeviceList* node1 = node; + num = 1; + while (node1 != NULL) + { + printf("DeviceInfo id: %d\n", num); + printf("device id: %d\n", node1->device.devId); + node1 = node1->next; + num++; + } + printf("please select device num: "); + scanf_s("%d", &num); + node = GetDeviceInfo(num); + if (node == NULL) { + printf("GetDeviceInfo fail\n"); + return; + } + + if (node->status == DEVICE_DISCOVERY) { + node->requestId = g_requestId; + node->status = DEVICE_JOINING; + int ret = HichainGmAddMemberToGroup(&node->device, g_groupId); + if (ret) { + printf("HichainGmAddMemberToGroup fail:%d\n", ret); + node->requestId = ERR_RET; + node->status = DEVICE_DISCOVERY; + return; + } + } +} + +static void PublishSuccess(int publishId) +{ + printf("CB: publish %d done\n", publishId); +} + +static void PublishFailed(int publishId, PublishFailReason reason) +{ + printf("CB: publish %d failed, reason=%d\n", publishId, (int)reason); +} + +static int PublishServiceInterface(void) +{ + PublishInfo info = { + .publishId = PUBLISH_ID, + .mode = DISCOVER_MODE_PASSIVE, + .medium = COAP, + .freq = LOW, + .capability = DEFAULT_CAPABILITY, + .capabilityData = NULL, + .dataLen = 0, + }; + IPublishCallback cb = { + .OnPublishSuccess = PublishSuccess, + .OnPublishFail = PublishFailed, + }; + return PublishService(APP_ID, &info, &cb); +} + +static void DeviceFound(const DeviceInfo* device) +{ + printf("CB: devName=%s", device->devName); + + if (CheckDeviceExist(device)) { + printf("device:%s udid:%s is already in List\n", device->devName, device->devId); + return; + } + SaveDeviceInfo(device); +} + +static void DiscoverySuccess(int subscribeId) +{ + printf("CB: discover subscribeId=%d\n", subscribeId); +} + +static void DiscoveryFailed(int subscribeId, DiscoveryFailReason reason) +{ + printf("CB: discover subscribeId=%d fail, reason=%d\n", subscribeId, (int)reason); +} + +static int DiscoveryInterface() +{ + SubscribeInfo info = { + .subscribeId = PUBLISH_ID, + .mode = DISCOVER_MODE_ACTIVE, + .medium = COAP, + .freq = LOW, + .isSameAccount = false, + .isWakeRemote = false, + .capability = DEFAULT_CAPABILITY, + .capabilityData = NULL, + .dataLen = 0, + }; + IDiscoveryCallback cb = { + .OnDeviceFound = DeviceFound, + .OnDiscoverFailed = DiscoveryFailed, + .OnDiscoverySuccess = DiscoverySuccess, + }; + return StartDiscovery(APP_ID, &info, &cb); +} + +static void RemoveSessionServerInterface(void) +{ + int ret = RemoveSessionServer(APP_ID, SESSION_NAME); + if (ret) { + printf("RemoveSessionServer fail:%d\n", ret); + } +} + +static int OpenSessionInterface(const char* peerNetworkId) +{ + SessionAttribute attr = { + .dataType = TYPE_BYTES, + .linkTypeNum = 1, + .linkType[0] = LINK_TYPE_WIFI_WLAN_2G, + .attr = {RAW_STREAM}, + }; + + return OpenSession(SESSION_NAME, SESSION_NAME, peerNetworkId, DEFAULT_GROUP_NAME, &attr); +} + +static void CloseSessionInterface(int sessionId) +{ + CloseSession(sessionId); +} + +static int GetAllNodeDeviceInfoInterface(NodeBasicInfo** dev) +{ + int ret, num; + + ret = GetAllNodeDeviceInfo(APP_ID, dev, &num); + if (ret) { + printf("GetAllNodeDeviceInfo fail:%d\n", ret); + return -1; + } + + printf("return %d Node\n", num); + for (int i = 0; i < num; i++) { + printf("deviceName=%s\n", i + 1, dev[i]->deviceName); + printf("\tnetworkId=%s\n", dev[i]->networkId); + printf("\tType=%d\n", dev[i]->deviceTypeId); + } + + return num; +} + +static void FreeNodeInfoInterface(NodeBasicInfo* dev) +{ + FreeNodeInfo(dev); +} + +static void commnunicate(void) +{ + NodeBasicInfo* dev = NULL; + char cData[] = "hello world test"; + int dev_num, sessionId, input, ret; + int timeout = 10; + + dev_num = GetAllNodeDeviceInfoInterface(&dev); + if (dev_num <= 0) { + return; + } + + printf("\nInput Node num to commnunication:"); + scanf_s("%d", &input); + if (input <= 0 || input > dev_num) { + printf("error input num\n"); + goto err_input; + } + + g_sessionId = -1; + sessionId = OpenSessionInterface(dev[input - 1].networkId); + if (sessionId < 0) { + printf("OpenSessionInterface fail, ret=%d\n", sessionId); + goto err_OpenSessionInterface; + } + printf("sessionId:%d", sessionId); + while (timeout) { + printf("sessionId:%d", g_sessionId); + if (g_sessionId == sessionId) { + ret = SendBytes(sessionId, cData, strlen(cData) + 1); + if (ret) { + printf("SendBytes fail:%d\n", ret); + } + break; + } + timeout--; + sleep(2); + } + CloseSessionInterface(sessionId); +err_OpenSessionInterface: +err_input: + FreeNodeInfoInterface(dev); +} + +int main() +{ + int ret; + bool loop = true; + printf("\nInput y to have pinCoude;Input n to delete pinCode:"); + while (true) + { + char c = getchar(); + if (c == 'y') + { + pinFlag = true; + break; + } + else if (c == 'n') + { + pinFlag = false; + break; + } + else + { + printf("\nInput y to have pinCoude;Input n to delete pinCode:"); + } + } + char out[MAX_UDID_LEN] = "ABCDEF11ABCDEF22ABCDEF11ABCDEF11ABCDEF11ABCDEF11ABCDEF11ABCDEF11"; + ret = sprintf_s(g_udid, MAX_UDID_LEN, "%s", out);//类似于udid = out + if (ret <= 0) { + printf("sprintf_s error.\n"); + return ret; + } + printf("GGUID:%s\n", g_udid); + ret = HichainInit(); + if (ret) { + printf("HichainInit fail\n"); + return ret; + } + + ret = CreateSessionServerInterface(); + if (ret) { + printf("CreateSessionServer fail, ret=%d\n", ret); + return ret; + } + + ret = PublishServiceInterface(); + if (ret) { + printf("PublishService fail, ret=%d\n", ret); + goto err_PublishServiceInterface; + } + + ret = DiscoveryInterface(); + if (ret != 0) { + printf("DiscoveryInterface fail\n"); + goto err_DiscoveryInterface; + } + + while (loop) { + + printf("\nInput l to list device;Input c to commuicate;Input s to stop:"); + while (true) { + char c = getchar(); + if (c == 'c') { + commnunicate(); + continue; + } + else if (c == 'l') + { + ListDevice(); + } + else if (c == 's') { + loop = false; + break; + } + else if (c == '\n') { + break; + } + else { + continue; + } + } + } + + StopDiscovery(APP_ID, PUBLISH_ID); + FreeDeviceInfo(); +err_DiscoveryInterface: + UnPublishService(APP_ID, PUBLISH_ID); +err_PublishServiceInterface: + HichainGmUnRegCallback(); + return ret; + +} + + diff --git a/dsoftbus/extended_auth/READ.md b/dsoftbus/extended_auth/READ.md new file mode 100644 index 0000000000000000000000000000000000000000..4b05cb889eaaedc1ed5b655b0042281cc4b09641 --- /dev/null +++ b/dsoftbus/extended_auth/READ.md @@ -0,0 +1,43 @@ +# 一种基于分布式软总线的设备认证新方法 + +## 背景 + +通过引入分布式软总线技术,社区已经实现欧拉与鸿蒙设备、以及欧拉设备之间的互联互通;当前软总线在创建连接的过程中,会调用hichain模块的认证接口,与对端的设备进行认证操作。hichain模块为OpenHarmony提供设备认证能力,支持通过点对点认证方式创建可信群组。本项目实现了一种无pin码认证设备,完成一种自定义认证实现。 + +## 方法使用 + +该方法也兼容有pin码的使用 + +### 客户端 + +具体两个客户端的代码在Client文件夹当中,在运行客户端程序时候,根据提示输入n选择无pin码方式(具体的device id需要在程序处修改)。 + +### 服务端 + +服务端修改程序之后打一个patch,对于patch的使用,在dosftbus.spec当中添加 + +`Patch0018: 0001-nopincode.patch` + +`%patch18 -p1 -d ${dsoftbus_build_dir}` + +然后重新安装rpm包。 + +## 测试 + +拉起两端设备之后,device1和device2均选择无pin码设备认证方式,测试结果 + +![](E:\Summer\最终提交\测试截图\无pin码\clientn.jpg) + +![servern](E:\Summer\最终提交\测试截图\无pin码\servern.jpg) + +![client](E:\Summer\最终提交\测试截图\无pin码\client.png)![server](E:\Summer\最终提交\测试截图\无pin码\server.jpg) + +设备认证方法仍旧兼容有pin码认证,测试结果如图 + +![](E:\Summer\最终提交\测试截图\有pin码\clienty.jpg) + +![](E:\Summer\最终提交\测试截图\有pin码\servery.jpg) + +![](E:\Summer\最终提交\测试截图\有pin码\client.jpg) + +![](E:\Summer\最终提交\测试截图\有pin码\server.jpg) diff --git a/dsoftbus/extended_auth/Server/0001-nopincode.patch b/dsoftbus/extended_auth/Server/0001-nopincode.patch new file mode 100644 index 0000000000000000000000000000000000000000..a4b77a060fc9ed4ab40e11bf817349b8b62e247c --- /dev/null +++ b/dsoftbus/extended_auth/Server/0001-nopincode.patch @@ -0,0 +1,118 @@ +From 5ef18e437ea494c167cd2176bda83abd6440176e Mon Sep 17 00:00:00 2001 +From: root +Date: Mon, 18 Sep 2023 11:30:46 +0800 +Subject: [PATCH] 001 + +--- + .../iso_task/iso_task_common.c | 26 +++++++++++++------ + .../pake_task/pake_task_common.c | 24 ++++++++++++----- + 2 files changed, 36 insertions(+), 14 deletions(-) + +diff --git a/base/security/deviceauth/services/authenticators/src/account_unrelated/iso_task/iso_task_common.c b/base/security/deviceauth/services/authenticators/src/account_unrelated/iso_task/iso_task_common.c +index 0292e9a..970df7a 100644 +--- a/base/security/deviceauth/services/authenticators/src/account_unrelated/iso_task/iso_task_common.c ++++ b/base/security/deviceauth/services/authenticators/src/account_unrelated/iso_task/iso_task_common.c +@@ -379,25 +379,35 @@ static int FillPkgNameAndServiceType(IsoParams *params, const CJson *in) + static int FillPin(IsoParams *params, const CJson *in) + { + if (params->opCode == OP_BIND) { ++ bool pinFlag = true; + const char *pinString = GetStringFromJson(in, FIELD_PIN_CODE); + if (pinString == NULL) { + LOGE("Get pin failed."); + return HC_ERROR; + } +- if (strlen(pinString) < MIN_PIN_LEN || strlen(pinString) > MAX_PIN_LEN) { ++ if(strlen(pinString)==0) ++ pinFlag = false; ++ if (pinFlag == true && (strlen(pinString) < MIN_PIN_LEN || strlen(pinString) > MAX_PIN_LEN)) { + LOGE("Pin is too short."); + return HC_ERR_INVALID_PARAMS; + } +- params->pinCodeString = (char *)HcMalloc(strlen(pinString) + 1, 0); ++ params->pinCodeString = (char *)HcMalloc(pinFlag ? strlen(pinString) + 1 : 6,0); + if (params->pinCodeString == NULL) { + LOGE("malloc pinCode failed."); + return HC_ERR_ALLOC_MEMORY; + } +- if (memcpy_s(params->pinCodeString, strlen(pinString) + 1, pinString, strlen(pinString)) != EOK) { +- LOGE("memcpy pinCodeString failed."); +- (void)memset_s(params->pinCodeString, strlen(pinString) + 1, 0, strlen(pinString) + 1); +- return HC_ERR_MEMORY_COPY; +- } ++ if(pinFlag) ++ { ++ if (memcpy_s(params->pinCodeString, strlen(pinString) + 1, pinString, strlen(pinString)) != EOK) { ++ LOGE("memcpy pinCodeString failed."); ++ (void)memset_s(params->pinCodeString, strlen(pinString) + 1, 0, strlen(pinString) + 1); ++ return HC_ERR_MEMORY_COPY; ++ } ++ } ++ else ++ { ++ LOGI("NOPIN"); ++ } + } + return HC_SUCCESS; + } +@@ -516,7 +526,7 @@ static int AuthGeneratePsk(const Uint8Buff *seed, IsoParams *params) + + static int AuthGeneratePskUsePin(const Uint8Buff *seed, IsoParams *params, const char *pinString) + { +- Uint8Buff messageBuf = { (uint8_t *)pinString, (uint32_t)strlen(pinString) }; ++ Uint8Buff messageBuf = { (uint8_t *)pinString,(uint32_t)strlen(pinString) }; + Uint8Buff pskBuf = { params->baseParams.psk, sizeof(params->baseParams.psk) }; + uint8_t hash[SHA256_LEN] = { 0 }; + Uint8Buff hashBuf = { hash, sizeof(hash) }; +diff --git a/base/security/deviceauth/services/authenticators/src/account_unrelated/pake_task/pake_task_common.c b/base/security/deviceauth/services/authenticators/src/account_unrelated/pake_task/pake_task_common.c +index c617af6..21534ea 100644 +--- a/base/security/deviceauth/services/authenticators/src/account_unrelated/pake_task/pake_task_common.c ++++ b/base/security/deviceauth/services/authenticators/src/account_unrelated/pake_task/pake_task_common.c +@@ -107,26 +107,38 @@ ERR: + + static int32_t FillPskWithPin(PakeParams *params, const CJson *in) + { ++ bool pinFlag = true; + const char *pinString = GetStringFromJson(in, FIELD_PIN_CODE); + if (pinString == NULL) { + LOGE("Get pin code failed."); + return HC_ERR_JSON_GET; + } +- if (strlen(pinString) < MIN_PIN_LEN || strlen(pinString) > MAX_PIN_LEN) { ++ if(strlen(pinString)==0) ++ pinFlag = false; ++ if (pinFlag == true && (strlen(pinString) < MIN_PIN_LEN || strlen(pinString) > MAX_PIN_LEN)) { + LOGE("Pin code len is invalid."); + return HC_ERR_INVALID_LEN; + } + +- int res = InitSingleParam(&(params->baseParams.psk), strlen(pinString)); ++ int res = InitSingleParam(&(params->baseParams.psk),pinFlag ? strlen(pinString) : 5); + if (res != HC_SUCCESS) { + LOGE("InitSingleParam for psk failed, res: %d.", res); + return res; + } +- if (memcpy_s(params->baseParams.psk.val, params->baseParams.psk.length, ++ if(pinFlag) ++ { ++ if (memcpy_s(params->baseParams.psk.val, params->baseParams.psk.length, + pinString, strlen(pinString)) != HC_SUCCESS) { +- LOGE("Memcpy for pin code failed."); +- FreeAndCleanKey(¶ms->baseParams.psk); +- return HC_ERR_MEMORY_COPY; ++ LOGE("Memcpy for pin code failed."); ++ FreeAndCleanKey(¶ms->baseParams.psk); ++ return HC_ERR_MEMORY_COPY; ++ } ++ ++ } ++ else ++ { ++ ++ params->baseParams.psk.length = 5; + } + + return HC_SUCCESS; +-- +2.33.0 + diff --git a/dsoftbus/extended_auth/Server/dsoftbus.spec b/dsoftbus/extended_auth/Server/dsoftbus.spec new file mode 100644 index 0000000000000000000000000000000000000000..9313edb2e65571a35962023a9c1c353cfc501ce1 --- /dev/null +++ b/dsoftbus/extended_auth/Server/dsoftbus.spec @@ -0,0 +1,210 @@ +%define debug_package %{nil} +%global source_dsoftbus_standard dsoftbus_standard +%global release_dsoftbus_standard v3.1.2-release +%global source_embedded_ipc embedded-ipc +%global release_embedded_ipc v1.0.0-release +%global source_commonlibrary_c_utils commonlibrary_c_utils +%global source_security_device_auth security_device_auth +%global source_security_huks security_huks +%global source_third_party_libcoap third_party_libcoap +%global source_third_party_mbedtls third_party_mbedtls +%global source_build build +%global release_build OpenHarmony-v3.0.2-LTS +%global openHarmony_source_release OpenHarmony-v3.1.2-Release + +Name: dsoftbus +Version: 1.0.0 +Release: 3 +Summary: openEuler embedded softbus capability support +License: Apache License 2.0 +Url: https://openeuler.gitee.io/yocto-meta-openeuler/features/distributed_softbus.html +Source0: https://gitee.com/openeuler/%{source_dsoftbus_standard}/repository/archive/%{release_dsoftbus_standard}.tar.gz #/%{source_dsoftbus_standard}-%{release_dsoftbus_standard}.tar.gz +Source1: https://gitee.com/openeuler/%{source_embedded_ipc}/repository/archive/%{release_embedded_ipc}.tar.gz #/%{source_embedded_ipc}-%{release_embedded_ipc}.tar.gz +Source2: https://gitee.com/openharmony/%{source_commonlibrary_c_utils}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_commonlibrary_c_utils}-%{openHarmony_source_release}.tar.gz +Source3: https://gitee.com/openharmony/%{source_security_device_auth}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_security_device_auth}-%{openHarmony_source_release}.tar.gz +Source4: https://gitee.com/openharmony/%{source_security_huks}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_security_huks}-%{openHarmony_source_release}.tar.gz +Source5: https://gitee.com/openharmony/%{source_third_party_libcoap}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_third_party_libcoap}-%{openHarmony_source_release}.tar.gz +Source6: https://gitee.com/openharmony/%{source_third_party_mbedtls}/repository/archive/%{openHarmony_source_release}.tar.gz #/%{source_third_party_mbedtls}-%{openHarmony_source_release}.tar.gz +Source7: https://gitee.com/openharmony/%{source_build}/repository/archive/%{release_build}.tar.gz #/%{source_build}-%{release_build}.tar.gz + +Patch0000: 0000-add-dsoftbus-build-support-for-embedded-env.patch +Patch0001: 0001-support-hichian-for-openeuler.patch +Patch0002: 0002-add-deviceauth-ipc-sdk-compile.patch +Patch0003: 0003-Adaptation-for-dsoftbus.patch +Patch0004: 0004-Adaptation-for-dsoftbus-v3.1.2.patch +Patch0005: 0005-fix-CVE-2021-43666.patch +Patch0006: 0006-fix-CVE-2021-45451.patch +Patch0007: 0007-support-huks-for-openeuler.patch +Patch0008: 0008-support-deviceauth-for-openeuler.patch +Patch0009: 0009-adapter-deviceauth-ipc-service.patch +Patch0010: 0010-simplify-dependency-on-third-party-packages.patch +Patch0011: 0011-change-set-for-obs-build.patch +Patch0012: 0012-Adaptation-for-dsoftbus.patch +Patch0013: 0013-add-productdefine-for-openeuler.patch +Patch0014: 0014-add-depend-for-openeuler.patch +Patch0015: 0015-simplify-dependency-on-third-party-packages.patch +Patch0016: 0016-adapter-cjson-in-openEuler-for-softbus.patch +Patch0017: 0017-simplify-dependency-for-dsoftbus-standard.patch +Patch0018: 0001-001.patch +BuildRequires: gcc, g++, cmake, python, zip, unzip, ninja-build, git, libboundscheck, cjson-devel, openssl-devel, gn + +%description +OpenEuler supports distributed softbus capability, which is part of openEuler's embedded capability + +%prep +# Create the directories needed for the build +dsoftbus_build_dir="%{_builddir}/dsoftbus_build" +dsoftbus_prebuilts_build_tools="${dsoftbus_build_dir}/prebuilts/build-tools/linux-x86/bin" +dsoftbus_thirdparty="${dsoftbus_build_dir}/third_party" +dsoftbus_utils="${dsoftbus_build_dir}/utils" +dsoftbus_src="${dsoftbus_build_dir}/foundation/communication" +dsoftbus_hichain="${dsoftbus_build_dir}/base/security" +dsoftbus_bounds_checking="${dsoftbus_thirdparty}/bounds_checking_function" +dsoftbus_productdefine="${dsoftbus_build_dir}/productdefine" +dsoftbus_depend="${dsoftbus_build_dir}/depend" + +mkdir -p ${dsoftbus_prebuilts_build_tools} +mkdir -p ${dsoftbus_thirdparty} +mkdir -p ${dsoftbus_utils} +mkdir -p ${dsoftbus_src} +mkdir -p ${dsoftbus_hichain} +mkdir -p ${dsoftbus_bounds_checking} +mkdir -p ${dsoftbus_productdefine} +mkdir -p ${dsoftbus_depend} + +# Decompressing the compressed package +%setup -q -T -D -b 0 -n %{source_dsoftbus_standard}-%{release_dsoftbus_standard} +%setup -q -T -D -b 1 -n %{source_embedded_ipc}-%{release_embedded_ipc} +%setup -q -T -D -b 2 -n %{source_commonlibrary_c_utils}-%{openHarmony_source_release} +%setup -q -T -D -b 3 -n %{source_security_device_auth}-%{openHarmony_source_release} +%setup -q -T -D -b 4 -n %{source_security_huks}-%{openHarmony_source_release} +%setup -q -T -D -b 5 -n %{source_third_party_libcoap}-%{openHarmony_source_release} +%setup -q -T -D -b 6 -n %{source_third_party_mbedtls}-%{openHarmony_source_release} +%setup -q -T -D -b 7 -n %{source_build}-%{release_build} + +cd %{_builddir} +mv %{source_dsoftbus_standard}-%{release_dsoftbus_standard} %{source_dsoftbus_standard} +mv %{source_embedded_ipc}-%{release_embedded_ipc} %{source_embedded_ipc} + +#copy gn +gn_dir=$(which gn) +cp ${gn_dir[0]} ${dsoftbus_prebuilts_build_tools} + +# copy ninja +ninja_dir=$(which ninja) +cp ${ninja_dir[0]} ${dsoftbus_prebuilts_build_tools} + +# unpack third_party +mv %{_builddir}/%{source_build}-%{release_build} ${dsoftbus_build_dir}/build +mkdir %{_builddir}/%{source_build}-%{release_build} +mv %{_builddir}/%{source_third_party_libcoap}-%{openHarmony_source_release} ${dsoftbus_thirdparty}/libcoap +mv %{_builddir}/%{source_third_party_mbedtls}-%{openHarmony_source_release} ${dsoftbus_thirdparty}/mbedtls +mkdir -p ${dsoftbus_thirdparty}/cJSON + +# unpack hichain +mv %{_builddir}/%{source_security_huks}-%{openHarmony_source_release} ${dsoftbus_hichain}/huks +mv %{_builddir}/%{source_security_device_auth}-%{openHarmony_source_release} ${dsoftbus_hichain}/deviceauth + +# unpack utils +mv %{_builddir}/%{source_commonlibrary_c_utils}-%{openHarmony_source_release} ${dsoftbus_utils}/native + +# do patch +%patch -p1 -d ${dsoftbus_build_dir}/build +%patch1 -p1 -d ${dsoftbus_build_dir}/build +%patch2 -p1 -d ${dsoftbus_build_dir}/build +%patch3 -p1 -d ${dsoftbus_utils}/native +%patch4 -p1 -d ${dsoftbus_thirdparty}/mbedtls +%patch5 -p1 -d ${dsoftbus_thirdparty}/mbedtls +%patch6 -p1 -d ${dsoftbus_thirdparty}/mbedtls +%patch7 -p1 -d ${dsoftbus_hichain}/huks +%patch8 -p1 -d ${dsoftbus_hichain}/deviceauth +%patch9 -p1 -d ${dsoftbus_hichain}/deviceauth +%patch10 -p1 -d ${dsoftbus_hichain}/deviceauth +%patch11 -p1 -d ${dsoftbus_build_dir}/build +%patch12 -p1 -d ${dsoftbus_thirdparty}/bounds_checking_function +%patch13 -p1 -d ${dsoftbus_productdefine} +%patch14 -p1 -d ${dsoftbus_depend} +%patch15 -p1 -d ${dsoftbus_hichain}/huks +%patch16 -p1 -d ${dsoftbus_thirdparty}/cJSON +%patch17 -p1 -d %{_builddir}/%{source_dsoftbus_standard} +%patch18 -p1 -d ${dsoftbus_build_dir} +# init gn root +ln -s ${dsoftbus_build_dir}/build/build_scripts/build.sh ${dsoftbus_build_dir}/build.sh +ln -s ${dsoftbus_build_dir}/build/core/gn/dotfile.gn ${dsoftbus_build_dir}/.gn + +# link selfcode +ln -s %{_builddir}/embedded-ipc ${dsoftbus_build_dir}/depend/ipc +ln -s %{_builddir}/dsoftbus_standard ${dsoftbus_src}/dsoftbus + +# link toolchain +toolchain_path="/usr1/openeuler/gcc/openeuler_gcc_arm64le" +ln -s ${toolchain_path} ${dsoftbus_build_dir}/toolchain + +# copy libboundscheck file +mkdir ${dsoftbus_thirdparty}/bounds_checking_function/include +cp /usr/include/securec*.h ${dsoftbus_thirdparty}/bounds_checking_function/include/ + +# link cjson +cjson_devel_include="/usr/include/cjson/cJSON.h" +ln -s ${cjson_devel_include} ${dsoftbus_thirdparty}/cJSON/cJSON.h + +%ifarch x86_64 + sed -i 's/"target_cpu": "arm64"/"target_cpu": "x86_64"/' ${dsoftbus_productdefine}/common/device/openEuler.json +%endif + +%build +rm -rf %{_builddir}/dsoftbus_build/out +cd %{_builddir}/dsoftbus_build +./build.sh --product-name openEuler + +%install +dsoftbus_build_dir="%{_builddir}/dsoftbus_build" +%ifarch x86_64 + dsoftbus_release_dir_name="ohos-x86_64-release" +%endif +%ifarch aarch64 + dsoftbus_release_dir_name="ohos-arm64-release" +%endif + +install -d %{buildroot}/%{_includedir}/dsoftbus +install -d %{buildroot}/%{_libdir} +install -d %{buildroot}/%{_bindir} +install -d %{buildroot}/data/data/deviceauth/ + +# prepare so +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/common/common/*.so %{buildroot}/%{_libdir} +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/*.so %{buildroot}/%{_libdir} +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/huks/*.so %{buildroot}/%{_libdir} +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/deviceauth_standard/*.so %{buildroot}/%{_libdir} + +# prepare bin +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/softbus_server_main %{buildroot}/%{_bindir} + +# prepare head files +install -m 554 \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/discovery/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/common/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/bus_center/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/transport/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/core/common/include/softbus_errcode.h \ +${dsoftbus_build_dir}/base/security/deviceauth/interfaces/innerkits/*.h \ +${dsoftbus_build_dir}/third_party/cJSON/*.h \ +${dsoftbus_build_dir}/third_party/bounds_checking_function/include/*.h \ + %{buildroot}/%{_includedir}/dsoftbus + +%files +%{_includedir}/dsoftbus/* +%{_bindir}/softbus_server_main +%{_libdir}/*.so +/data/data + +%changelog +* Wed Nov 30 2022 liheavy - 1.0.0-3 +- Disassemble yocto-embedded-tools and replace cjson, ninja, gn, openssl, libboundscheck +- with openEuler software package + +* Wed Nov 23 2022 xuchongyu - 1.0.0-2 +- add URL,change branch of libboundscheck to 22.03-LTS-SP1 + +* Tue Nov 22 2022 xuchongyu - 1.0.0-1 +- init dsoftbus diff --git a/dsoftbus/extended_auth/testpicture/have_pinCode/client.jpg b/dsoftbus/extended_auth/testpicture/have_pinCode/client.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9078d9a0fa723cae5dbf837f3eeb1b88c24e473a Binary files /dev/null and b/dsoftbus/extended_auth/testpicture/have_pinCode/client.jpg differ diff --git a/dsoftbus/extended_auth/testpicture/have_pinCode/clienty.jpg b/dsoftbus/extended_auth/testpicture/have_pinCode/clienty.jpg new file mode 100644 index 0000000000000000000000000000000000000000..da6b90a935ac1c2494620f30814db577707c3a04 Binary files /dev/null and b/dsoftbus/extended_auth/testpicture/have_pinCode/clienty.jpg differ diff --git a/dsoftbus/extended_auth/testpicture/have_pinCode/server.jpg b/dsoftbus/extended_auth/testpicture/have_pinCode/server.jpg new file mode 100644 index 0000000000000000000000000000000000000000..29c3c7dd34ec5136ce81316e9698a10612f29677 Binary files /dev/null and b/dsoftbus/extended_auth/testpicture/have_pinCode/server.jpg differ diff --git a/dsoftbus/extended_auth/testpicture/have_pinCode/servery.jpg b/dsoftbus/extended_auth/testpicture/have_pinCode/servery.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0b8b95b7930996d2429817d278c32ad72ef91716 Binary files /dev/null and b/dsoftbus/extended_auth/testpicture/have_pinCode/servery.jpg differ diff --git a/dsoftbus/extended_auth/testpicture/no_pinCode/client.png b/dsoftbus/extended_auth/testpicture/no_pinCode/client.png new file mode 100644 index 0000000000000000000000000000000000000000..f1f2d44a48157e40f7ef03c81215f60f1903f6db Binary files /dev/null and b/dsoftbus/extended_auth/testpicture/no_pinCode/client.png differ diff --git a/dsoftbus/extended_auth/testpicture/no_pinCode/clientn.jpg b/dsoftbus/extended_auth/testpicture/no_pinCode/clientn.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ddac526fd3e6de1e4ef64c3b657561864a0a765e Binary files /dev/null and b/dsoftbus/extended_auth/testpicture/no_pinCode/clientn.jpg differ diff --git a/dsoftbus/extended_auth/testpicture/no_pinCode/server.png b/dsoftbus/extended_auth/testpicture/no_pinCode/server.png new file mode 100644 index 0000000000000000000000000000000000000000..2cc53051cef23e161f3928c78245042dd40c18af Binary files /dev/null and b/dsoftbus/extended_auth/testpicture/no_pinCode/server.png differ diff --git a/dsoftbus/extended_auth/testpicture/no_pinCode/servern.jpg b/dsoftbus/extended_auth/testpicture/no_pinCode/servern.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8e7ba72e688430c3114b203d97d94a055540acf0 Binary files /dev/null and b/dsoftbus/extended_auth/testpicture/no_pinCode/servern.jpg differ