Xinyuan-LilyGO / LilyGo-T-SIM7080G

42 stars 22 forks source link

deviceCert and devicePrivateKey convert error #5

Closed wenjun1972 closed 1 year ago

wenjun1972 commented 1 year ago

Hi, I am trying to use rootCA, device cert and private key to register on AWS MQTT. Below is part of my code running on Platformio.

writeCaFiles(3, "rootCA.crt", AWS_CA, strlen_P(AWS_CA));
writeCaFiles(3, "deviceCert.crt", AWS_CRT, strlen_P(AWS_CRT));
writeCaFiles(3, "devicePrivateKey.key", AWS_PSK, strlen_P(AWS_PSK));

modem.sendAT("+CSSLCFG=\"CONVERT\",2,\"rootCA.crt\"");
if (modem.waitResponse() != 1)
{
    Serial.println("Convert rootCA.crt failed!");
}

modem.sendAT("+CSSLCFG=\"CONVERT\",1,\"deviceCert.crt\"");
if (modem.waitResponse() != 1)
{
    Serial.println("Convert deviceCert.crt failed!");
}
modem.sendAT("+CSSLCFG=\"CONVERT\",1,\"devicePrivateKey.key\"");
if (modem.waitResponse() != 1)
{
    Serial.println("Convert devicePrivateKey.key failed!");
}

I can see three certs were well downloaded OK Writing:1680 overage:0 Wirte done!!! AT+CFSTERM

Whereas the covert process showed OK only to rootCA certs but failed on deviceCert and devicePrivateKey, any idea about these errors?

AT+CSSLCFG="CONVERT",2,"rootCA.crt" OK

AT+CSSLCFG="CONVERT",1,"deviceCert.crt" ERROR Convert deviceCert.crt failed!

AT+CSSLCFG="CONVERT",1,"devicePrivateKey.key" ERROR Convert devicePrivateKey.key failed!

wenjun1972 commented 1 year ago

changed as below and then the convert "OK" now. modem.sendAT("+CSSLCFG=\"CONVERT\",1,\"deviceCert.crt\",\"devicePrivateKey.pem\""); if (modem.waitResponse() != 1) { Serial.println("Convert deviceCert.crt and devicePrivateKey.pem failed!"); }

But have the connection issue after that, will close this issue for convert error.

AT+SMSSL=1,"rootCA.crt","deviceCert.crt","devicePrivateKey.pem"

ERROR