Ewon TechForum
Providing technical solutions to technical requests


Error Retreiving Azure Cert/Key
hernfiry Offline
Junior Member
#1
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?
Reply

simon Offline
eWON Support
#2
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/down...xy&ext=key and I have done a quick try with https://ewonsupport.biz/azurehelper/down...xy&ext=crt
and it worked.

Simon
Reply

hernfiry Offline
Junior Member
#3
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!
Reply

simon Offline
eWON Support
#4
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
Reply

hernfiry Offline
Junior Member
#5
Thanks Simon! It's working now. Appreciate it!
Reply



Possibly Related Threads…
04-04-2020, 11:45 AM
Last Post: LewisH304
03-03-2020, 11:35 PM
Last Post: simon
14-02-2020, 06:11 PM
Last Post: simon
31-01-2020, 05:27 PM
Last Post: simon
  JAVA Azure IOTHub Connector Started by simon
1 Replies - 1.375 Views
11-12-2019, 12:19 PM
Last Post: simon
30-10-2019, 07:52 PM
Last Post: IceControls
  Mqtt Error Started by Azzamjj
1 Replies - 618 Views
05-09-2019, 04:31 PM
Last Post: simon
30-03-2019, 05:02 PM
Last Post: simon
12-03-2019, 07:10 PM
Last Post: simon
30-01-2019, 01:28 PM
Last Post: JohanW



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy