feat(fabric parameters check):
when creat fabric wallet, checke parameters "account cert"
@@ -37,6 +37,10 @@ boatwallet.c is the SDK main entry.
#include "curl/curl.h"
#endif
+#if (PROTOCOL_USE_HLFABRIC == 1 || PROTOCOL_USE_HWBCS == 1)
+#include "mbedtls/x509_crt.h"
+#endif
+
BoatIotSdkContext g_boat_iot_sdk_context;
@@ -103,6 +107,7 @@ static BOAT_RESULT BoatWalletCreatParaCheck(BoatProtocolType protocol_type,const
#if (PROTOCOL_USE_HLFABRIC == 1 || PROTOCOL_USE_HWBCS == 1)
case BOAT_PROTOCOL_HLFABRIC:
case BOAT_PROTOCOL_HWBCS:
+ #include "mbedtls/x509_crt.h"
if (wallet_config_ptr != NULL)
{
BoatHlfabricWalletConfig* fabric_config_ptr = wallet_config_ptr;
@@ -122,6 +127,13 @@ static BOAT_RESULT BoatWalletCreatParaCheck(BoatProtocolType protocol_type,const
BoatLog(BOAT_LOG_NORMAL, "persistent wallet prikey_format err.");
return BOAT_ERROR_WALLET_KEY_FORMAT_ERR;
}
+ mbedtls_x509_crt m_certificate;
+ mbedtls_x509_crt_init(&m_certificate);
+ int status = mbedtls_x509_crt_parse(&m_certificate,fabric_config_ptr->accountCertContent.content, fabric_config_ptr->accountCertContent.length);
+ if(status != BOAT_SUCCESS){
+ BoatLog(BOAT_LOG_NORMAL, "persistent wallet account cert err. ");
+ return BOAT_ERROR;
+ }
}
break;
