How to read Error Codes
응답
18. 7. 4 오전 11:01

Hello,

ich have again some problems with my XDK,

Error in package ID: 153  Severity code: 2 Error code: 69, module ID : 8 

I am using the HTTPExampleClient and want to use https with my own certificate but wenn I try to parse the certificate form HEX with the x509.h lib, I get an error 22 and this ERROR message. I found the makefile for package ID 153 but I cant tell what the rest means. 

Can someone please tell me the meaning?

 

later when I try to sent an https GET I get this:

 INFO | XDK DEVICE 1: securityCallback - CURRENT_TIME request
 INFO | XDK DEVICE 1: securityCallback - CRT_CA request
 INFO | XDK DEVICE 1: securityCallback - CRT_OWN_CERTIFICATE request
 INFO | XDK DEVICE 1: Error in package ID: 30  Severity code: 2 Error code: 8, module ID : 29 

but here I don#t even finde the makefile with the package ID

 

thx for the helf

Simon :/

0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 4 오후 2:24 as a reply to Simon Schulz.
Hello Simon,

Unfortunately, the HTTPS implementation of the HTTPExampleClient example is currently only working with Postman-echo.com . Other certificates as your currently do not work with the example. But this is a known issue and a fix for that might come with the next release of the XDK-Workbench. But that I cannot tell for sure.

Nevertheless, if you want to develop an application including an own certificate, you can use as alternative the implementation from the HTTPS Guide , which implements HTTPS on the low level simplelink TCP API.

In regards to the error code you are receiving. The package describes a complete software package, such as BLE, Wi-Fi, FreeRTOS and so on. It can be found in the top level makefile of every package. In your case, this is the ServalPal package of the platform folder in the SDK of the XDK.

Furthermore, the module ID can be found in the header file with a corresponding name to the package itself. In this case it is BCDS_ServalPal.h . There you should find an enumeration called BCDS_SERVALPAL_ModuleID_E , which contains the different modules of the ServalPAL package. This then points to the module BCDS_SERVALPAL_MODULE_ID_SERVALPALWIFITCP .

The error code itself describes either a package specific error code, which can also be found in BCDS_ServalPal.h in the enumeration ServalPal_Retcode_E or a general error code, which are located in the header file BCDS_Retcode.h . In this case, it points to an general error code called RETCODE_RTOS_QUEUE_ERROR .

The complete error describes the issue, I mentioned before, no only the certificate from Postman-echo.com is currently working with the HTTPExampleClient .

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 5 오전 10:39 as a reply to Franjo Stjepandic.

Hello,

ok I try now to implement it with simplelink, but when I try to flashCertificate() I allway get an return -100 in the writing. I looked it up and -100 is VERIFY_NO_ERROR_HANDLING_IN_PROGRESS(); 

I also handled the Open Create File but it gives me an SL_RET_CODE_OK.

I can't find the problem in writting to the certificate.

 

void flashCertificate(char *fileName, _u8* data, _u32 length) {
	// For the purpose of readability this code has no error handling.
	// The simplelink API provides return codes of the type _i32 that can be
	// checked for the value SL_RET_CODE_OK
	_i32 sl_returnValue = SL_RET_CODE_OK;
	// The datetime is required for certificate validation:
	SlDateTime_t dateTime;
	dateTime.sl_tm_day = (_u32)5;
	dateTime.sl_tm_mon = (_u32)7;
	dateTime.sl_tm_year = (_u32)2018;
	dateTime.sl_tm_hour = (_u32)0;
	dateTime.sl_tm_min = (_u32)0;
	dateTime.sl_tm_sec = (_u32)0;
	sl_returnValue = sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION, SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME, sizeof(SlDateTime_t), (_u8 *)(&dateTime));
	if(sl_returnValue == SL_RET_CODE_OK) {
		printf("Date and Time set\n\r");
	} else {
		printf("ERROR: setting Date and Time\n\r");
	}
	// If a file with the same name already exists, call this first:
	sl_FsDel((_u8*) fileName, 0);																	// <---
	// The file handle should not be 0 after a file was successfully created:
	_i32 fileHandle = 0;
	sl_returnValue = sl_FsOpen((_u8*) fileName, FS_MODE_OPEN_CREATE(2048, _FS_FILE_PUBLIC_WRITE | _FS_FILE_PUBLIC_READ), NULL, &fileHandle);
	if(sl_returnValue == SL_RET_CODE_OK) {
		printf("File created and opend\n\r");
	} else {
		printf("ERROR: ceating and opening the file\n\r");
	}
	// If the file is longer than 1024 bytes, you need to loop the writing.
	// "length" contains the length of the certificate
	// "writtenLength" contains the amount of actually written bytes.
	_i32 writtenLen = sl_FsWrite(fileHandle, 0, data, length);
	printf("Write 1: %ld file Handle: %ld\n\r", writtenLen, fileHandle);
	_i16 fs_close = sl_FsClose(fileHandle, NULL, NULL, 0);
	printf("File Close: %d file Handle: %ld\n\r", fs_close, fileHandle);
}

And that is what I get in return:

 INFO | Connection to port 'COM8' established
 INFO | XDK DEVICE 1: Date and Time set
 INFO | XDK DEVICE 1: File created and opend
 INFO | XDK DEVICE 1: Write 1: -100 file Handle: 457063178
 INFO | XDK DEVICE 1: File Close: -17 file Handle: 457063178
 INFO | XDK DEVICE 1: Severe error from wifi package, Error code: 1 and module ID is :3 
 INFO | XDK DEVICE 1: Error in package ID: 10  Severity code: 2 Error code: 1, module ID : 3 
 INFO | XDK DEVICE 1: HTTP request:
 INFO | XDK DEVICE 1: ======
 INFO | XDK DEVICE 1: GET https://adeted01.de.festo.net/mokasin/api/v1/xdk HTTP/1.1
 INFO | XDK DEVICE 1: Host: adeted01.de.festo.net
 INFO | XDK DEVICE 1: ======
 INFO | XDK DEVICE 1: sl_Send failed: -1

My certificate + filename + length

#define CA_FILE_NAME "digicert.der"
unsigned char digicert_root_crt[] = {
	0x30, 0x82, 0x07, 0x25, 0x30, 0x82, 0x05, 0x0D, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x13, 0x1A,
	0x00, 0x00, 0xDE, 0x36, 0x00, 0x82, 0xF0, 0x19, 0x50, 0x16, 0xB5, 0xFA, 0x00, 0x00, 0x00, 0x00,
	0xDE, 0x36, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05,
	0x00, 0x30, 0x43, 0x31, 0x13, 0x30, 0x11, 0x06, 0x0A, 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C,
	0x64, 0x01, 0x19, 0x16, 0x03, 0x6E, 0x65, 0x74, 0x31, 0x15, 0x30, 0x13, 0x06, 0x0A, 0x09, 0x92,
	0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x19, 0x16, 0x05, 0x66, 0x65, 0x73, 0x74, 0x6F, 0x31,
	0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0C, 0x46, 0x65, 0x73, 0x74, 0x6F, 0x53,
	0x75, 0x62, 0x43, 0x41, 0x30, 0x31, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x37, 0x31, 0x31, 0x32, 0x33,
	0x31, 0x37, 0x35, 0x39, 0x34, 0x31, 0x5A, 0x17, 0x0D, 0x31, 0x39, 0x31, 0x31, 0x32, 0x33, 0x31,
	0x37, 0x35, 0x39, 0x34, 0x31, 0x5A, 0x30, 0x20, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04,
	0x03, 0x13, 0x15, 0x61, 0x64, 0x65, 0x74, 0x65, 0x64, 0x30, 0x31, 0x2E, 0x64, 0x65, 0x2E, 0x66,
	0x65, 0x73, 0x74, 0x6F, 0x2E, 0x6E, 0x65, 0x74, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09,
	0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00,
	0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xAF, 0x8E, 0x27, 0xBE, 0x6D, 0x14, 0x07,
	0xAA, 0x2E, 0x07, 0x5D, 0x7A, 0x4A, 0x78, 0x88, 0xC1, 0x4B, 0xA9, 0xED, 0xD4, 0x64, 0x9F, 0x71,
	0x76, 0x7B, 0x9F, 0xD8, 0xB5, 0x28, 0x60, 0xDE, 0x64, 0xA2, 0x4D, 0x3B, 0x7D, 0x18, 0x17, 0xBE,
	0xAA, 0xD9, 0xB3, 0xF8, 0x01, 0xB5, 0xA1, 0x41, 0x9E, 0x57, 0xD0, 0x51, 0x4E, 0x2A, 0xC1, 0x9D,
	0x21, 0xF4, 0x72, 0xE1, 0x2F,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FC, 0x15, 0x0F, 0xCE, 0xEF, 0x9D,
	0x35, 0xCA, 0xB0, 0x32, 0x44, 0xFC, 0xCE, 0x18, 0x6F, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82,
	0x03, 0x33, 0x30, 0x82, 0x03, 0x2F, 0x30, 0x3E, 0x06, 0x09, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82,
	0x37, 0x15, 0x07, 0x04, 0x31, 0x30, 0x2F, 0x06, 0x27, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37,
	0x15, 0x08, 0x85, 0x91, 0x9C, 0x3B, 0x86, 0x9C, 0xDB, 0x22, 0x82, 0xF5, 0x8F, 0x27, 0x82, 0xDC,
	0xED, 0x46, 0x81, 0xF1, 0x9F, 0x59, 0x81, 0x74, 0x83, 0xE1, 0xE6, 0x31, 0x84, 0xE0, 0xE2, 0x5A,
	0x02, 0x01, 0x64, 0x02, 0x01, 0x06, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30,
	0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x0B, 0x06, 0x03, 0x55,
	0x1D, 0x0F, 0x04, 0x04, 0x03, 0x02, 0x05, 0xA0, 0x30, 0x1B, 0x06, 0x09, 0x2B, 0x06, 0x01, 0x04,
	0x01, 0x82, 0x37, 0x15, 0x0A, 0x04, 0x0E, 0x30, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01,
	0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14,
	0x11, 0x7E, 0x56, 0xBA, 0xCA, 0xDC, 0x6B, 0x3C, 0x92, 0x58, 0x4C, 0x46, 0x42, 0x97, 0x50, 0x34,
	0x68, 0xBB, 0x7A, 0xB6, 0x30, 0x55, 0x06, 0x03, 0x55, 0x1D, 0x11, 0x04, 0x4E, 0x30, 0x4C, 0x82,
	0x15, 0x61, 0x64, 0x65, 0x74, 0x65, 0x64, 0x30, 0x31, 0x2E, 0x64, 0x65, 0x2E, 0x66, 0x65, 0x73,
	0x74, 0x6F, 0x2E, 0x6E, 0x65, 0x74, 0x82, 0x12, 0x61, 0x64, 0x65, 0x74, 0x65, 0x64, 0x30, 0x31,
	0x2E, 0x66, 0x65, 0x73, 0x74, 0x6F, 0x2E, 0x6E, 0x65, 0x74, 0x82, 0x15, 0x73, 0x64, 0x65, 0x75,
	0x30, 0x32, 0x31, 0x39, 0x2E, 0x75, 0x78, 0x2E, 0x66, 0x65, 0x73, 0x74, 0x6F, 0x2E, 0x6E, 0x65,
	0x74, 0x82, 0x08, 0x73, 0x64, 0x65, 0x75, 0x30, 0x32, 0x31, 0x39, 0x30, 0x1F, 0x06, 0x03, 0x55,
	0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xB9, 0xEE, 0x80, 0x03, 0xB8, 0x56, 0x2D, 0xD9,
	0x91, 0x29, 0xEF, 0x9B, 0xA5, 0xBB, 0xC2, 0x0C, 0xDB, 0xDC, 0xA0, 0x5E, 0x30, 0x81, 0xFF, 0x06,
	0x03, 0x55, 0x1D, 0x1F, 0x04, 0x81, 0xF7, 0x30, 0x81, 0xF4, 0x30, 0x81, 0xF1, 0xA0, 0x81, 0xEE,
	0xA0, 0x81, 0xEB, 0x86, 0x81, 0xB2, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x2F, 0x43, 0x4E,
	0x3D, 0x46, 0x65, 0x73, 0x74, 0x6F, 0x53, 0x75, 0x62, 0x43, 0x41, 0x30, 0x31, 0x2C, 0x43, 0x4E,
	0x3D, 0x53, 0x44, 0x45, 0x54, 0x33, 0x30, 0x39, 0x33, 0x2C, 0x43, 0x4E, 0x3D, 0x43, 0x44, 0x50,
	0x2C, 0x43, 0x4E, 0x3D, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x25, 0x32, 0x30, 0x4B, 0x65, 0x79,
	0x25, 0x32, 0x30, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2C, 0x43, 0x4E, 0x3D, 0x53,
	0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2C, 0x43, 0x4E, 0x3D, 0x43, 0x6F, 0x6E, 0x66, 0x69,
	0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x44, 0x43, 0x3D, 0x66, 0x65, 0x73, 0x74,
	0x6F, 0x2C, 0x44, 0x43, 0x3D, 0x6E, 0x65, 0x74, 0x3F, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69,
	0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x4C, 0x69,
	0x73, 0x74, 0x3F, 0x62, 0x61, 0x73, 0x65, 0x3F, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C,
	0x61, 0x73, 0x73, 0x3D, 0x63, 0x52, 0x4C, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
	0x69, 0x6F, 0x6E, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x86, 0x34, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F,
	0x2F, 0x63, 0x72, 0x6C, 0x2E, 0x66, 0x65, 0x73, 0x74, 0x6F, 0x2E, 0x63, 0x6F, 0x6D, 0x70, 0x61,
	0x6E, 0x79, 0x2F, 0x43, 0x65, 0x72, 0x74, 0x45, 0x6E, 0x72, 0x6F, 0x6C, 0x6C, 0x2F, 0x46, 0x65,
	0x73, 0x74, 0x6F, 0x53, 0x75, 0x62, 0x43, 0x41, 0x30, 0x31, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x82,
	0x01, 0x13, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x82, 0x01, 0x05,
	0x30, 0x82, 0x01, 0x01, 0x30, 0x81, 0xA9, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30,
	0x02, 0x86, 0x81, 0x9C, 0x6C, 0x64, 0x61, 0x70, 0x3A, 0x2F, 0x2F, 0x2F, 0x43, 0x4E, 0x3D, 0x46,
	0x65, 0x73, 0x74, 0x6F, 0x53, 0x75, 0x62, 0x43, 0x41, 0x30, 0x31, 0x2C, 0x43, 0x4E, 0x3D, 0x41,
	0x49, 0x41, 0x2C, 0x43, 0x4E, 0x3D, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x25, 0x32, 0x30, 0x4B,
	0x65, 0x79, 0x25, 0x32, 0x30, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2C, 0x43, 0x4E,
	0x3D, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2C, 0x43, 0x4E, 0x3D, 0x43, 0x6F, 0x6E,
	0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2C, 0x44, 0x43, 0x3D, 0x66, 0x65,
	0x73, 0x74, 0x6F, 0x2C, 0x44, 0x43, 0x3D, 0x6E, 0x65, 0x74, 0x3F, 0x63, 0x41, 0x43, 0x65, 0x72,
	0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x3F, 0x62, 0x61, 0x73, 0x65, 0x3F, 0x6F, 0x62,
	0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C, 0x61, 0x73, 0x73, 0x3D, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66,
	0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79,
	0x30, 0x53, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x47, 0x68, 0x74,
	0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x63, 0x72, 0x6C, 0x2E, 0x66, 0x65, 0x73, 0x74, 0x6F, 0x2E, 0x63,
	0x6F, 0x6D, 0x70, 0x61, 0x6E, 0x79, 0x2F, 0x43, 0x65, 0x72, 0x74, 0x45, 0x6E, 0x72, 0x6F, 0x6C,
	0x6C, 0x2F, 0x53, 0x44, 0x45, 0x54, 0x33, 0x30, 0x39, 0x33, 0x2E, 0x66, 0x65, 0x73, 0x74, 0x6F,
	0x2E, 0x6E, 0x65, 0x74, 0x5F, 0x46, 0x65, 0x73, 0x74, 0x6F, 0x53, 0x75, 0x62, 0x43, 0x41, 0x30,
	0x31, 0x2E, 0x63, 0x72, 0x74, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
	0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, 0x02, 0x01, 0x00, 0x28, 0x84, 0x47, 0x58, 0x95, 0xAF, 0xE6,
	0x0C, 0xC7, 0x0A, 0x9A, 0xAA, 0x2F, 0x43, 0x4A, 0x0D, 0xC6, 0x8E, 0xCF, 0x87, 0x88, 0x32, 0x22,
	0x24, 0xC9, 0x94, 0xE0, 0x98, 0xF1, 0x5C, 0x40, 0x17, 0x5B, 0x5F, 0xBA, 0xBE, 0xE9, 0x76, 0xAD,
	0x10, 0x7A, 0xF3, 0x2B, 0x8E, 0xE0, 0x15, 0xA5, 0x23, 0x5F, 0x21, 0x3A, 0xD0, 0xE9, 0x36, 0xBB,
	0x84, 0xBD, 0x92, 0x45, 0x74, 0x57, 0x2C, 0xC8, 0x62, 0x16, 0x0F, 0xB5, 0xAE, 0xE2, 0xF4, 0x93,
	0x58, 0x1B, 0x95, 0xBE, 0x0E, 0x7C, 0x24, 0x78, 0x1D, 0xB0, 0xBA, 0x1D, 0x37, 0x61, 0xC1, 0x10,
	0x1C, 0xE4, 0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80, 0xF4, 0x4F, 0x23,
	0xD2, 0xE6, 0xFB, 0x04, 0x9F, 0x43, 0xC7, 0x74, 0x5E, 0xEF, 0x2E, 0x95, 0x10, 0xC2, 0x84, 0x27,
	0xF7, 0xE3, 0x6A, 0xBC, 0x6F, 0xE8, 0x2F, 0xC2, 0x8F, 0x71, 0x05, 0x96, 0x24, 0xCA, 0xC5, 0x19,
	0x98, 0xA1, 0xAB, 0x8C, 0x02, 0xF3, 0x18, 0xA3, 0x26, 0xA9, 0x8D, 0xF5, 0x1C, 0xDC, 0x96, 0xDB,
	0xB9, 0x46, 0xEA, 0xE6, 0x48, 0x62, 0x26, 0xE3, 0x03
};
int digicert_root_crt_len = 1833;

 

 

and finally how I call the function:

flashCertificate(CA_FILE_NAME, digicert_root_crt, digicert_root_crt_len);

 

(what I need to say is, there shoud have been a file created but in my projekt or elsewhere I cant finde the filename or the certificate.) Sorry for that! It came to my minde that the file is on the XDK I guess.

0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 5 오후 2:17 as a reply to Simon Schulz.

Well it has been two lang day's but I got everything to work except the https GET request

 

Adding the certificate to the socket works fine, but 

when I try to connect I get an error -456 what means:

#define SL_ESECBADCAFILE                      (-456)  /* error secure level bad CA file */

some help on that would be nice.

I use the normal https guid code 

connectServerSecure()

and I wrote the comple certificate on the XDK with flashing

 

Simon :)

 

0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 9 오후 1:25 as a reply to Simon Schulz.
Hello Simon,

I am glad to hear that you find a solution to write the complete certificate into the flash memory. Would you be so kind and share your solution with the community that other users with similar issues can benefit from it. Did you use the implementation from this thread here as starting point ? Or does it at least implement the same base idea?

How did you prove that your implementation is correct? As far as I can observe, there might be still an issue with the certificate, since the error you are receiving indicates that.

Regarding the certificate location: The certificate flashing process is simplelink specific. The certificate will be written on the flash memory of the simplelink Wi-Fi chip. Thus you can not directly see or read it.

Kind regards,
Franjo
0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 9 오후 12:57 as a reply to Franjo Stjepandic.

Hello, I checkt everything twice and I wrote the certificate into a file and dann I read the file and printf the certificate.

But I alwas get the error -456

void flashCertificate(char *fileName, _u8* data1, _u8* data2, _u8* data3,_u8* InputBuffer) {
	// For the purpose of readability this code has no error handling.
	// The simplelink API provides return codes of the type _i32 that can be
	// checked for the value SL_RET_CODE_OK
	_i32 sl_returnValue = SL_RET_CODE_OK;
	// The datetime is required for certificate validation:
	SlDateTime_t dateTime;
	dateTime.sl_tm_day = (_u32)5;
	dateTime.sl_tm_mon = (_u32)7;
	dateTime.sl_tm_year = (_u32)2018;
	dateTime.sl_tm_hour = (_u32)0;
	dateTime.sl_tm_min = (_u32)0;
	dateTime.sl_tm_sec = (_u32)0;
	sl_returnValue = sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION, SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME, sizeof(SlDateTime_t), (_u8 *)(&dateTime));
	if(sl_returnValue == SL_RET_CODE_OK) {
		printf("Date and Time set\n\r");
	} else {
		printf("ERROR: setting Date and Time\n\r");
	}
	// If a file with the same name already exists, call this first:
	sl_FsDel((unsigned char *)fileName, 0);																	// <---
	// The file handle should not be 0 after a file was successfully created:
	_i32 fileHandle = 0;
	sl_returnValue = sl_FsOpen((_u8*) fileName, FS_MODE_OPEN_CREATE(4096, _FS_FILE_PUBLIC_WRITE | _FS_FILE_PUBLIC_READ), NULL, &fileHandle);
	if(sl_returnValue == SL_RET_CODE_OK) {
		printf("File created and opend\n\r");
	} else {
		printf("ERROR: ceating and opening the file\n\r");
	}

	unsigned long Offset = 0;
	sl_returnValue = sl_FsWrite(fileHandle, Offset, data1, 960);
	printf("Write 1: %ld file Handle: %ld\n\r", sl_returnValue, fileHandle);

	Offset = 960;
	sl_returnValue = sl_FsWrite(fileHandle, Offset, data2, 960);
	printf("Write 2: %ld file Handle: %ld\n\r", sl_returnValue, fileHandle);

	Offset = 1920;
	sl_returnValue = sl_FsWrite(fileHandle, Offset, data3, 658);
	printf("Write 3: %ld file Handle: %ld\n\r", sl_returnValue, fileHandle);

	sl_returnValue = sl_FsClose(fileHandle, NULL, NULL, 0);
	printf("File Close: %ld file Handle: %ld\n\r", sl_returnValue, fileHandle);


	sl_returnValue = sl_FsOpen((_u8*) fileName, FS_MODE_OPEN_READ, NULL, &fileHandle);
	Offset = 0;
	sl_returnValue = sl_FsRead( fileHandle, Offset, (unsigned char *)InputBuffer, 960);
	sl_returnValue = sl_FsClose(fileHandle, NULL, NULL , 0);
	for(int i = 0; i < 960; i+=1) {
		printf("%c", inputBuffer[i]);
	}

	sl_returnValue = sl_FsOpen((_u8*) fileName, FS_MODE_OPEN_READ, NULL, &fileHandle);
	Offset = 960;
	sl_returnValue = sl_FsRead( fileHandle, Offset, (unsigned char *)InputBuffer, 960);
	sl_returnValue = sl_FsClose(fileHandle, NULL, NULL , 0);
	for(int i = 0; i < 960; i+=1) {
		printf("%c", inputBuffer[i]);
	}
//	printf("  \n\r");

	sl_returnValue = sl_FsOpen((_u8*) fileName, FS_MODE_OPEN_READ, NULL, &fileHandle);
	Offset = 1920;
	sl_returnValue = sl_FsRead( fileHandle, Offset, (unsigned char *)InputBuffer, 658);
	sl_returnValue = sl_FsClose(fileHandle, NULL, NULL , 0);
	for(int i = 0; i < 658; i+=1) {
		printf("%c", inputBuffer[i]);
	}
	printf("  \n\r");

}


void connectServerSecure(void){
	_i32 sl_returnValue = SL_RET_CODE_OK;

	// Getting the IP address of HOST_NAME:
	Ip_Address_T destAddr = 0;
	sl_returnValue = PAL_getIpaddress((uint8_t*) HOST_NAME, &destAddr);
	if(sl_returnValue == SL_RET_CODE_OK) {
		printf("IP got\n\r");
	} else {
		printf("ERROR: getting IP\n\r");
	}
	printf("IP Adress Server: %ld\n\r", destAddr);

	// Creating a Socket (socketHandle ≦ 0 indicates an error):
	_i16 socketHandle = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, SL_SEC_SOCKET);


	// Adding the certificate to the socket:
	sl_returnValue = sl_SetSockOpt(socketHandle, SL_SOL_SOCKET, SL_SO_SECURE_FILES_CA_FILE_NAME, CA_FILE_NAME, strlen(CA_FILE_NAME));
	if(sl_returnValue == SL_RET_CODE_OK) {
		printf("adding the certificate to the socket\n\r");
	} else {
		printf("ERROR: Adding the certificate to the socket\n\r");
	}

	// Configuration the connection settings (IP, Port, etc.):
	SlSockAddrIn_t addr;
	addr.sin_family = SL_AF_INET;
	addr.sin_port = sl_Htons(443);
	addr.sin_addr.s_addr = destAddr;

	// Connecting:
	sl_returnValue = sl_Connect(socketHandle, ( SlSockAddr_t *)&addr, sizeof(SlSockAddrIn_t));
	if(sl_returnValue == SL_RET_CODE_OK) {
		printf("connected\n\r");
	} else {
		printf("ERROR: connecting\terror code: %ld\n\r", sl_returnValue);
	}

	// requesting:
	sendGetRequest(socketHandle, HOST_NAME, "/mokasin/api/v1/xdk");

	// Closing:
	sl_returnValue = sl_Close(socketHandle);
	if(sl_returnValue == SL_RET_CODE_OK) {
		printf("socket Closed\n\r");
	} else {
		printf("ERROR: closing socket\n\r");
	}
}


char outBuf[1024];
char inBuf[1024];

void sendGetRequest(_i16 socketHandle, char* host, char* path)
{

	_i16 bytesSent = 0;
	_i16 bytesReceived = 0;
	sprintf(outBuf, "GET https://%s%s HTTP/1.1\r\nHost: %s\r\n\r\n", host, path, host);
	printf("HTTP request:\r\n");
	printf("\r\n======\r\n");
	printf("%s", outBuf);
	printf("\r\n======\r\n");
	bytesSent = sl_Send(socketHandle, (const void *) outBuf, strlen(outBuf), 0);
	if( bytesSent <= 0 ) {
		printf("sl_Send failed: %i\r\n", bytesSent);
		return;
	}
	printf("HTTP response:\r\n");
	printf("\r\n======\r\n");
	//printf("bytesSent: %d\tbytesReceived: %d\n\r", bytesSent, bytesReceived);
	int linesPrinted = 0;
	do {
		bytesReceived = sl_Recv(socketHandle, inBuf, 1024, 0);
		int lastStart = 0;
		int pos = 0;

		while (linesPrinted < 10 && pos < bytesReceived) {
			if (inBuf[pos] == '\n') {
				printf("%.*s", pos - lastStart - 1, inBuf + lastStart);
				printf("\r\n");
				lastStart = pos;
				linesPrinted++;
			}
			pos++;
		}
	} while(bytesReceived > 0);
	if (linesPrinted == 10) {
		printf("...\r\n");
	}
	printf("\r\n======\r\n");
}

the network setup and everything is fine

than I call the functions

networkSetup();

flashCertificate(CA_FILE_NAME, digicert_root_crt1, digicert_root_crt2, digicert_root_crt3, inputBuffer);
timerInit(10, &connectServerSecure);

 

 


 INFO | XDK DEVICE 1: IP Adress Server: 150995210
 INFO | XDK DEVICE 1: adding the certificate to the socket
 INFO | XDK DEVICE 1: ERROR: connecting	error code: -456
 INFO | XDK DEVICE 1: HTTP request:
 INFO | XDK DEVICE 1: ======
 INFO | XDK DEVICE 1: GET https://adeted01.de.festo.net/mokasin/api/v1/xdk HTTP/1.1
 INFO | XDK DEVICE 1: Host: adeted01.de.festo.net
 INFO | XDK DEVICE 1: ======
 INFO | XDK DEVICE 1: sl_Send failed: -1
 INFO | XDK DEVICE 1: socket Closed

I really can#t fix the promblem and need help

0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 9 오후 3:38 as a reply to Simon Schulz.

Hello Simon,

do not worry we will solve this issue together.

To make progress, it would be helpful if you could go more into detail about the certificate you use. How long is the certificate you are currently using and did you extracted the bytes from it from a .der certificate? It seem like you are using different certificates in your latest posts.

Additionally, i would recommend that you implement your writing process to the internal flash memory of the CC3100 dynamically to avoid "off by one errors", nevertheless this should not cause the error.

On that behalf, I recommend to try the following code snippet for your writing routine.

_u32 remainingLength = length;

while(remainingLength > 0) {

remainingLength -= sl_FsWrite( fileHandle, length - remainingLength, data+(length - remainingLength), remainingLength > 1024 ? 1024 : remainingLength // the maximum write size is 1024 for one iteration );

}

Regarding that, please note that the limit of one writing process is not limited to 960 bytes, but to 1024 bytes.

If all of my hints does not lead to a solution, i would ask you to share your complete project with me that I can reproduce your issue. This could be done via GitHub or if classified via mail.

Kind regards,
Franjo

0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 10 오전 6:16 as a reply to Franjo Stjepandic.

Hello,

the certificate is complettely on my xdk because I do the writing and to check the certificate I close the file and reopen it, than I read the certificate and printf it in the console. I checkt it and nothing is missing.

But I git it from an .cer certificate.

 

And I am not allowed to post the certificate in here

Sorry

 

Simon :)

0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 10 오후 9:03 as a reply to Simon Schulz.
Hello Simon,

Thank you for providing further information about your issue.

Unfortunately, without the sources I can only assume what cause the error regarding the bad certificate.

On that behalf, did you use the top-level root CA certificate or did you choose another certificate in the certificate chain? Additionally, did you test your implementation with another certificate, to ensure that it is working, for example postman-echo.com ?

Regarding exchanging the source code and the certificate, if we agree to exchange anything via email, then please note that this is sealed via an NDA and your code and certificate will definitely stay in private.

But of course, it is absolutely up to you what to share. But please keep in mind that the more you share the better we can help you finding a solution.

Kind regards,
Franjo
0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 11 오전 8:27 as a reply to Franjo Stjepandic.

Hello,

to your question:

Did you use the top-level root CA certificate or did you choose another certificate in the certificate chain?

I did not use the top level certificate I used a certificate from the chain, to call it like this. But I got to it, how the https Guid showed me to get it. 

I I will try this tomorrw and if it does not work I will send you these parts of my project via Mail.

 

thanks for the great interest and help regarding my problem.

Simon

0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 11 오후 2:39 as a reply to Simon Schulz.
Hello Simon,

I am glad to help. This is what the XDK Support is here for.

In regards to the certificate, I would kindly ask you to try out the Root CA certificate instead of a certificate within the chain. The error might be caused because you did not use the Root CA certificate.

Additionally, please keep me updated on your progress.

Kind regards,
Franjo
0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 16 오전 5:50 as a reply to Franjo Stjepandic.
So I tryed many other certifficates including the root certificates and I always get the same error. And I am pretty sure I have the right certificate.
0 (0 투표)
RE: How to read Error Codes
응답
18. 7. 16 오후 3:51 as a reply to Simon Schulz.
Hello Simon,

Thank you for the further information on using different certificates.

Unfortunately, I am on this point of view not able to pinpoint the error without taking a look at the source code of yours.

As such, it would be very helpful if we could exchange the source code via email.

For that, I would ask you to post your email address in here, that I am able to contact you.

Kind regards,
Franjo
0 (0 투표)
RE: How to read Error Codes
응답
19. 3. 26 오후 9:49 as a reply to Franjo Stjepandic.
I am running into an almost identical here, was there a solution here?
0 (0 투표)
RE: How to read Error Codes
응답
19. 8. 8 오전 4:40 as a reply to markus brun.
Hey there,

 I am also facing the same issue..Just wondering if you found the solution for it?
0 (0 투표)