Add Write\ReadBinaryKey to sample
This commit is contained in:
		| @@ -44,6 +44,7 @@ | |||||||
| /////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////// | ||||||
|  |  | ||||||
|  |  | ||||||
|  | unsigned char UTF8Value[] = {0xED, 0x98, 0x9C, 0xED, 0x98, 0xA4, 0xED, 0x95, 0xAB, 0xED, 0x9B, 0xA7, 0xED, 0x9D, 0x8F, 00}; | ||||||
|  |  | ||||||
| void Pause() | void Pause() | ||||||
| {  | {  | ||||||
| @@ -228,7 +229,7 @@ void ReadBinaryKey() | |||||||
| 		appSecretId.len = sscs_Utf8Strlen(inputID) + 1; | 		appSecretId.len = sscs_Utf8Strlen(inputID) + 1; | ||||||
| 		sscs_Utf8Strcpy(appSecretId.id, inputID); | 		sscs_Utf8Strcpy(appSecretId.id, inputID); | ||||||
|  |  | ||||||
| 		printf("SAMPLE: Calling miCASAReadKey\r\n"); | 		printf("SAMPLE: Calling miCASAReadBinaryKey\r\n"); | ||||||
|  |  | ||||||
| 		// open secretStore | 		// open secretStore | ||||||
| 		sscs_Utf8Strcpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID); | 		sscs_Utf8Strcpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID); | ||||||
| @@ -266,7 +267,15 @@ void ReadBinaryKey() | |||||||
| 		{ | 		{ | ||||||
| 			//set null			 | 			//set null			 | ||||||
| 			//memcpy(inputValue[valueLen + 1], | 			//memcpy(inputValue[valueLen + 1], | ||||||
| 			printf("KeyValue is %s\r\n", inputValue); | 			//printf("KeyValue is %s\r\n", inputValue); | ||||||
|  | 			if (!memcmp(inputValue, UTF8Value, valueLen)) | ||||||
|  | 			{ | ||||||
|  | 				printf("Matched\r\n"); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				printf("did not match\r\n"); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @@ -361,17 +370,17 @@ void WriteBinaryKey() | |||||||
| 	printf("Enter Key: ");		 | 	printf("Enter Key: ");		 | ||||||
| 	gets(inputKey); | 	gets(inputKey); | ||||||
|  |  | ||||||
| 	printf("Enter Value: "); | 	//printf("Enter Value: "); | ||||||
| 	gets(inputValue); | 	//gets(inputValue); | ||||||
| 	 | 	 | ||||||
| 	if ((sscs_Utf8Strlen(inputID) > 0) && | 	if ((sscs_Utf8Strlen(inputID) > 0) && | ||||||
| 		(sscs_Utf8Strlen(inputKey) > 0) && | 		(sscs_Utf8Strlen(inputKey) > 0)) | ||||||
| 		(sscs_Utf8Strlen(inputValue) > 0)) | 		 | ||||||
| 	{ | 	{ | ||||||
| 		appSecretId.len = sscs_Utf8Strlen(inputID) + 1; | 		appSecretId.len = sscs_Utf8Strlen(inputID) + 1; | ||||||
| 		sscs_Utf8Strcpy(appSecretId.id, inputID); | 		sscs_Utf8Strcpy(appSecretId.id, inputID); | ||||||
|  |  | ||||||
| 		printf("SAMPLE: Calling miCASAWriteKey\r\n"); | 		printf("SAMPLE: Calling miCASAWriteBinaryKey\r\n"); | ||||||
|  |  | ||||||
| 		// open secretStore | 		// open secretStore | ||||||
| 		sscs_Utf8Strcpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID); | 		sscs_Utf8Strcpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID); | ||||||
| @@ -386,15 +395,15 @@ void WriteBinaryKey() | |||||||
| 		sscs_Utf8Strcpy(kc.keychainID, SSCS_SESSION_KEY_CHAIN_ID); | 		sscs_Utf8Strcpy(kc.keychainID, SSCS_SESSION_KEY_CHAIN_ID); | ||||||
| 		kc.len = SSCS_S_KC_ID_CHARS; | 		kc.len = SSCS_S_KC_ID_CHARS; | ||||||
|  |  | ||||||
| 		valueLen = sscs_strlen(inputValue) + 1; | 		valueLen = strlen(UTF8Value) + 1; | ||||||
|  |  | ||||||
| 		miCASAWriteBinaryKey(context, | 		rcode = miCASAWriteBinaryKey(context, | ||||||
| 			0, | 			0, | ||||||
| 			&kc, | 			&kc, | ||||||
| 			&appSecretId, | 			&appSecretId, | ||||||
| 			inputKey, | 			inputKey, | ||||||
| 			strlen(inputKey)+1, | 			strlen(inputKey)+1, | ||||||
| 			inputValue, | 			UTF8Value, | ||||||
| 			&valueLen, | 			&valueLen, | ||||||
| 			NULL, | 			NULL, | ||||||
| 			&ext); | 			&ext); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user