[644][adas] 添加VIN码解析以及展示,修复因为证书尾部\n导致的域控证书校验失败问题
This commit is contained in:
@@ -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;//车型是否是红旗
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user