Switch to desktop version  
Error Retreiving Azure Cert/Key - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: Java (https://techforum.ewon.biz/forum-53.html)
+--- Thread: Error Retreiving Azure Cert/Key (/thread-1240.html)



Error Retreiving Azure Cert/Key - hernfiry - 09-04-2020

Hi,

Using a modified version of the Azure_MQTT Example, I'm having an issue where the cert/key downloaded via the Azure Helper has the following contents:

Code:
<br />
<b>Warning</b>:  filesize(): stat failed for generateFlexyCertificates/certificates/1213655791.crt in <b>C:\wamp64\www\azurehelper\downloadcert.php</b> on line <b>21</b><br />
<br />
<b>Warning</b>:  readfile(generateFlexyCertificates/certificates/1213655791.crt): failed to open stream: No such file or directory in <b>C:\wamp64\www\azurehelper\downloadcert.php</b> on line <b>23</b><br />

If I use the Helper and download the zip file, the cert/key is fine, but doing it via the direct php call, I get this error.

Any ideas?


RE: Error Retreiving Azure Cert/Key - simon - 10-04-2020

Hi,

What link to you use to download the cert and keys?What device name did you use ?
I have done a quick try with https://ewonsupport.biz/azurehelper/downloadcert.php?token=1464318422&name=flexy&ext=key and I have done a quick try with https://ewonsupport.biz/azurehelper/downloadcert.php?token=1464318422&name=flexy&ext=crt
and it worked.

Simon


RE: Error Retreiving Azure Cert/Key - hernfiry - 17-04-2020

I'm not sure why, but I'm not running into that issue anymore. However, I am running into another issue. It must be an issue with my code and I think I need another pair of eyes.



Here is the error message that my java program is outputting:


Code:
[AZUREIOT ERROR] Error while downloading Certificate and key from: 'https://ewonsupport.biz/azurehelper/downloadcert.php?token=1753054757&name=TestRack_Flexy&ext=crt'. ResultCrt: 32603, ResultKey: 32603 (next try in 20 secs)



If I look at event 32603 in the Event Log:





Code:
httpc-http request error (Code: 302 Reason: Found)


Now, if I copy the above URL from my error message and paste it into a browser on my computer, it works just fine and the crt and key download successfully. However, for some reason, my java program on the flexy cannot do this and gets the 302 code



Here is the code block:

Code:
String certificateServer = "https://ewonsupport.biz";
String certificateURL = "/azurehelper/downloadcert.php";

String certUrl = this.certificateURL + "?token=" + this.certificateToken + "&name=" +
    this.deviceID + "&ext=crt";
int ResultCrt = ScheduledActionManager.GetHttp(this.certificateServer,
    "/usr/" + this.deviceID + ".crt", certUrl);

String keyUrl = this.certificateURL + "?token=" + this.certificateToken + "&name=" +
    this.deviceID + "&ext=key";
int ResultKey = ScheduledActionManager.GetHttp(this.certificateServer,
    "/usr/" + this.deviceID + ".key", keyUrl);

if (ResultCrt == 0 && ResultKey == 0) {
    Log.addLog("Certificate and key downloaded.", Log.info);
} else {
    String errMsg = "Error while downloading Certificate and key from: ";
    errMsg += "'" + this.certificateServer + certUrl + "'. ";
    errMsg += "ResultCrt: " + ResultCrt + ", ";
    errMsg += "ResultKey: " + ResultKey;
    errMsg += " (next try in " + CONNECTION_ERR_TIMEOUT_S + " secs)";
    Log.addLog(errMsg, Log.error);

Thanks in advance!


RE: Error Retreiving Azure Cert/Key - simon - 20-04-2020

Hi,

This error occurs because we have changed the website "ewonsupport.biz" to "tools.ewonsupport.biz" and the Ewon does not support redirection like a web browser.
My apologizes for that.

Please use "https:\\tools.ewonsupport.biz" and it should work fine.

Simon


RE: Error Retreiving Azure Cert/Key - hernfiry - 22-04-2020

Thanks Simon! It's working now. Appreciate it!