[644][adas] 添加VIN码解析以及展示,修复因为证书尾部\n导致的域控证书校验失败问题

This commit is contained in:
xinfengkun
2024-05-24 18:05:59 +08:00
parent 98edf0ca49
commit ff990384bc
2 changed files with 8 additions and 3 deletions

View File

@@ -345,7 +345,8 @@ message CarConfigResp
double maxAcceleration = 8; //最大加速度, 单位m/s²
string carType = 9; //车辆类型
string subCarType = 10; //车辆子类型
reserved 11 to 100;
string vinCode = 11;//车辆vin码
reserved 12 to 100;
int32 mapVersion = 101;//dockVersion解析出版本号仅用于版本对比解析失败为-1。例如"MAP-taxi_RoboTaxi_df_2.8.0.3_20220928_test" 解析结果为20800
bool isDF = 102;//车型是否是东风
bool isHQ = 103;//车型是否是红旗

View File

@@ -40,8 +40,12 @@ public class CertificateUtils {
*/
public static ByteString encode(@NonNull String crt) {
if (TextUtils.isEmpty(crt)) return null;
String end = "-----END CERTIFICATE-----";
if (crt.endsWith("\n")) {
end = end + "\n";
}
char line = 0;
crt = crt.replace("-----BEGIN CERTIFICATE-----\n", "").replace("-----END CERTIFICATE-----", "");
crt = crt.replace("-----BEGIN CERTIFICATE-----\n", "").replace(end, "");
byte[] chars = new byte[crt.length()];
for (int i = 0; i < crt.length(); i++) {
char c = crt.charAt(i);
@@ -80,7 +84,7 @@ public class CertificateUtils {
}
builder.append(c);
}
builder.append("-----END CERTIFICATE-----");
builder.append("-----END CERTIFICATE-----\n");
return builder.toString();
}