Start modifying the test program to do more
diff --git a/dumper/dumper.c b/dumper/dumper.c
index 872c31d..15ff7de 100644
--- a/dumper/dumper.c
+++ b/dumper/dumper.c
@@ -30,7 +30,7 @@
 extern FOO Signer[];
 
 #ifdef USE_CBOR_CONTEXT
-#define CBOR_CONTEXT , NULL
+#define CBOR_CONTEXT_PARAM , NULL
 #else
 #define COBR_CONTEXT
 #endif
@@ -390,7 +390,7 @@
 	case CN_CBOR_BYTES:
 		DumpBytes(out, cbor, depth);
 		if ((pFOO != NULL) && (pFOO->children != NULL)) {
-			const cn_cbor * cbor3 = cn_cbor_decode(cbor->v.bytes, cbor->length, NULL CBOR_CONTEXT);
+			const cn_cbor * cbor3 = cn_cbor_decode(cbor->v.bytes, cbor->length, NULL CBOR_CONTEXT_PARAM);
 			if (cbor3 != NULL) {
 				WrapPrintF(out, fInComment ? " \\ " : " / ");
 				DumpTree(cbor3, out, pFOO->children, depth+1, true, true, true);
@@ -548,7 +548,7 @@
 
     //  Parse it
 
-    cn_cbor * cbor = cn_cbor_decode(pb, cb, NULL CBOR_CONTEXT);
+    cn_cbor * cbor = cn_cbor_decode(pb, cb, NULL CBOR_CONTEXT_PARAM);
 	if (cbor == NULL) {
 		fprintf(stderr, "Error parsing CBOR");
 		exit(1);
diff --git a/src/Recipient.c b/src/Recipient.c
index 22aa391..e33632b 100644
--- a/src/Recipient.c
+++ b/src/Recipient.c
@@ -120,3 +120,17 @@
 
 	return true;
 }
+
+bool COSE_Recipient_SetKey_EC(HCOSE_RECIPIENT h, const char* szCurve, const byte * pbX, int cbX, const byte * pbY, int cbY, cose_errback * perror)
+{
+	COSE_RecipientInfo * p;
+
+	if (!IsValidRecipientHandle(h) || (szCurve == NULL) || (pbX == NULL) || (pbY == NULL)) {
+		if (perror != NULL) perror->err = COSE_ERR_INVALID_PARAMETER;
+		return false;
+	}
+
+	p = (COSE_RecipientInfo *)h;
+
+	return true;
+}
diff --git a/src/cose.h b/src/cose.h
index 8aa37f1..3afe295 100644
--- a/src/cose.h
+++ b/src/cose.h
@@ -122,6 +122,7 @@
 
 HCOSE_RECIPIENT COSE_Encrypt_GetRecipient(HCOSE_ENCRYPT cose, int iRecipient, cose_errback * perr);
 bool COSE_Recipient_SetKey(HCOSE_RECIPIENT h, const byte * rgb, int cb, cose_errback * perr);
+bool COSE_Recipient_SetKey_EC(HCOSE_RECIPIENT h, const char* szCurve, const byte * pbX, int cbX, const byte * pbY, int cbY, cose_errback * perror);
 
 //
 //
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 6ae5afe..ad17da3 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -8,7 +8,7 @@
 
 set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dist_dir}/test )
 
-add_executable ( cose_test test.c )
+add_executable ( cose_test test.c json.c )
 
 target_link_libraries (cose_test PRIVATE cose-c )
 
diff --git a/test/json.c b/test/json.c
new file mode 100644
index 0000000..7a8bdc6
--- /dev/null
+++ b/test/json.c
@@ -0,0 +1,96 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <cn-cbor/cn-cbor.h>
+
+#include "json.h"
+
+const cn_cbor * ParseString(char * rgch, int ib, int cch)
+{
+	char ch;
+	int ib2;
+	cn_cbor * node = NULL;
+	cn_cbor * parent = NULL;
+	cn_cbor * root = NULL;
+
+	for (; ib < cch; ib++) {
+		node = NULL;
+		ch = rgch[ib];
+		switch (ch) {
+		case '{':
+			node = cn_cbor_map_create(NULL, NULL);
+			break;
+
+		case '}':
+			parent = parent->parent;
+			break;
+
+		case '[':
+			node = cn_cbor_array_create(NULL, NULL);
+			break;
+
+		case ']':
+			parent = parent->parent;
+			break;
+
+		case ' ':
+		case '\r':
+		case '\n':
+		case':':
+		case ',':
+			break;
+
+		case '"':
+			for (ib2 = ib + 1; ib2 < cch; ib2++) if (rgch[ib2] == '"') break;
+			rgch[ib2] = 0;
+			node = cn_cbor_string_create(&rgch[ib+1], NULL, NULL);
+			rgch[ib2] = '"';
+			ib = ib2;
+			break;
+
+		default:
+			fprintf(stderr, "Parse failure @ '%s'\n", &rgch[ib]);
+			break;
+		}
+
+		if ((node != NULL) && (parent != NULL)) {
+			node->parent = parent;
+			if (parent->last_child != NULL) {
+				parent->last_child->next = node;
+				parent->last_child = node;
+			}
+			else {
+				parent->first_child = node;
+			}
+			parent->last_child = node;
+			parent->length++;
+
+			if ((node->type == CN_CBOR_MAP) || (node->type == CN_CBOR_ARRAY)) {
+				parent = node;
+			}
+		}
+		if (parent == NULL) {
+			parent = node;
+			if (root == NULL) root = node;
+		}
+	}
+
+	return root;
+}
+
+const cn_cbor * ParseJson(char * fileName)
+{
+	int     cch;
+	char	rgch[8 * 1024];
+    FILE * fp = fopen(fileName, "r");
+
+	if (fp == NULL) {
+		fprintf(stderr, "Cannot open file '%s'\n", fileName);
+		exit(1);
+	}
+
+	cch = fread(rgch, 1, sizeof(rgch), fp);
+	fclose(fp);
+
+	return ParseString(rgch, 0, cch);
+}
diff --git a/test/json.h b/test/json.h
new file mode 100644
index 0000000..d24bcdd
--- /dev/null
+++ b/test/json.h
@@ -0,0 +1,3 @@
+#pragma once
+
+extern const cn_cbor * ParseJson(const char * fileName);
diff --git a/test/test.c b/test/test.c
index ffe702e..2a6d547 100644
--- a/test/test.c
+++ b/test/test.c
@@ -16,9 +16,12 @@
 int CFails = 0;
 
 #ifdef USE_CBOR_CONTEXT
-#define CBOR_CONTEXT , NULL
+cn_cbor_context * allocator;
+#define CBOR_CONTEXT_PARAM , allocator
+#define CBOR_CONTEXT_PARAM_COMMA allocator,
 #else
-#define CBOR_CONTEXT
+#define CBOR_CONTEXT_PARAM
+#define CBOR_CONTEXT_PARAM_COMMA
 #endif
 
 byte fromHex(char c)
@@ -34,7 +37,7 @@
 	const cn_cbor * pOutputs = cn_cbor_mapget_string(pControl, "output");
 	const cn_cbor * pCBOR;
 	byte * pb = NULL;
-	byte * pb2;
+	const byte * pb2;
 	int i;
 
 	if ((pOutputs == NULL) || (pOutputs->type != CN_CBOR_MAP)) {
@@ -77,12 +80,12 @@
 	int type;
 	int iRecipient;
 
-	hMAC = COSE_Decode(pbEncoded, cbEncoded, &type, COSE_mac_object, NULL, NULL);
+	hMAC = (HCOSE_MAC) COSE_Decode(pbEncoded, cbEncoded, &type, COSE_mac_object, NULL, NULL);
 	if (hMAC == NULL) exit(1);
 
 	if ((pInput == NULL) || (pInput->type != CN_CBOR_MAP)) exit(1);
 	pRecipients = cn_cbor_mapget_string(pInput, "recipients");
-	if ((pRecipients == NULL) || (pRecipients != CN_CBOR_ARRAY)) exit(1);
+	if ((pRecipients == NULL) || (pRecipients->type != CN_CBOR_ARRAY)) exit(1);
 
 	pRecipients = pRecipients->first_child;
 	for (iRecipient = 0; pRecipients != NULL; iRecipient++,pRecipients=pRecipients->next) {
@@ -96,7 +99,7 @@
 
 int MacMessage()
 {
-	HCOSE_MAC hEncObj = COSE_Mac_Init(NULL, NULL);
+	HCOSE_MAC hEncObj = COSE_Mac_Init(CBOR_CONTEXT_PARAM_COMMA NULL);
 	char * sz = "This is the content to be used";
 	byte rgbSecret[256 / 8] = { 'a', 'b', 'c' };
 	byte  rgbKid[6] = { 'a', 'b', 'c', 'd', 'e', 'f' };
@@ -104,7 +107,7 @@
 	size_t cb;
 	byte * rgb;
 
-	COSE_Mac_map_put(hEncObj, COSE_Header_Algorithm, cn_cbor_int_create(COSE_Algorithm_HMAC_256_256, NULL CBOR_CONTEXT), COSE_PROTECT_ONLY CBOR_CONTEXT);
+	COSE_Mac_map_put(hEncObj, COSE_Header_Algorithm, cn_cbor_int_create(COSE_Algorithm_HMAC_256_256, CBOR_CONTEXT_PARAM_COMMA NULL), COSE_PROTECT_ONLY, NULL);
 	COSE_Mac_SetContent(hEncObj, (byte *) sz, strlen(sz), NULL);
 
 	COSE_Mac_add_shared_secret(hEncObj, COSE_Algorithm_Direct, rgbSecret, sizeof(rgbSecret), rgbKid, cbKid, NULL);
@@ -158,7 +161,7 @@
 
 int SignMessage()
 {
-	HCOSE_SIGN hEncObj = COSE_Sign_Init(NULL, NULL);
+	HCOSE_SIGN hEncObj = COSE_Sign_Init(CBOR_CONTEXT_PARAM_COMMA NULL);
 	char * sz = "This is the content to be used";
 	size_t cb;
 	byte * rgb;
@@ -168,18 +171,18 @@
 		byte kid[] = { 0x6d, 0x65, 0x72, 0x69, 0x61, 0x64, 0x6f, 0x63, 0x2e, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x79, 0x62, 0x75, 0x63, 0x6, 0xb4, 0x06, 0x27, 0x56, 0x36, 0xb6, 0xc6, 0x16, 0xe6, 0x42, 0xe6, 0x57, 0x86, 0x16, 0xd7, 0x06, 0x65};
 		byte rgbD[] = {0xaf, 0xf9, 0x07, 0xc9, 0x9f, 0x9a, 0xd3, 0xaa, 0xe6, 0xc4, 0xcd, 0xf2, 0x11, 0x22, 0xbc, 0xe2, 0xbd, 0x68, 0xb5, 0x28, 0x3e, 0x69, 0x07, 0x15, 0x4a, 0xd9, 0x11, 0x84, 0x0f, 0xa2, 0x08, 0xcf};
 			
-			cn_cbor * pkey = cn_cbor_map_create(NULL CBOR_CONTEXT);
-	cn_cbor_mapput_int(pkey, COSE_Key_Type, cn_cbor_int_create(COSE_Key_Type_EC2, NULL CBOR_CONTEXT), NULL CBOR_CONTEXT);
-	cn_cbor_mapput_int(pkey, -1, cn_cbor_int_create(1, NULL CBOR_CONTEXT), NULL CBOR_CONTEXT);
-	cn_cbor_mapput_int(pkey, -2, cn_cbor_data_create(rgbX, sizeof(rgbX), NULL CBOR_CONTEXT), NULL CBOR_CONTEXT);
-	cn_cbor_mapput_int(pkey, -3, cn_cbor_data_create(rgbY, sizeof(rgbY), NULL CBOR_CONTEXT), NULL CBOR_CONTEXT);
-	cn_cbor_mapput_int(pkey, COSE_Key_ID, cn_cbor_data_create(kid, sizeof(kid), NULL CBOR_CONTEXT), NULL CBOR_CONTEXT);
-	cn_cbor_mapput_int(pkey, -4, cn_cbor_data_create(rgbD, sizeof(rgbD), NULL CBOR_CONTEXT), NULL CBOR_CONTEXT);
+			cn_cbor * pkey = cn_cbor_map_create(CBOR_CONTEXT_PARAM_COMMA NULL);
+	cn_cbor_mapput_int(pkey, COSE_Key_Type, cn_cbor_int_create(COSE_Key_Type_EC2, CBOR_CONTEXT_PARAM_COMMA NULL), CBOR_CONTEXT_PARAM_COMMA NULL);
+	cn_cbor_mapput_int(pkey, -1, cn_cbor_int_create(1, CBOR_CONTEXT_PARAM_COMMA NULL), CBOR_CONTEXT_PARAM_COMMA NULL);
+	cn_cbor_mapput_int(pkey, -2, cn_cbor_data_create(rgbX, sizeof(rgbX), CBOR_CONTEXT_PARAM_COMMA NULL), CBOR_CONTEXT_PARAM_COMMA NULL);
+	cn_cbor_mapput_int(pkey, -3, cn_cbor_data_create(rgbY, sizeof(rgbY), CBOR_CONTEXT_PARAM_COMMA NULL), CBOR_CONTEXT_PARAM_COMMA NULL);
+	cn_cbor_mapput_int(pkey, COSE_Key_ID, cn_cbor_data_create(kid, sizeof(kid), CBOR_CONTEXT_PARAM_COMMA NULL), CBOR_CONTEXT_PARAM_COMMA NULL);
+	cn_cbor_mapput_int(pkey, -4, cn_cbor_data_create(rgbD, sizeof(rgbD), CBOR_CONTEXT_PARAM_COMMA NULL), CBOR_CONTEXT_PARAM_COMMA NULL);
 
-	COSE_Sign_SetContent(hEncObj, (byte *) sz, strlen(sz) CBOR_CONTEXT);
-	COSE_Sign_add_signer(hEncObj, pkey, COSE_Algorithm_ECDSA_SHA_256 CBOR_CONTEXT);
+	COSE_Sign_SetContent(hEncObj, (byte *) sz, strlen(sz), NULL);
+	COSE_Sign_add_signer(hEncObj, pkey, COSE_Algorithm_ECDSA_SHA_256, NULL);
 
-	COSE_Sign_Sign(hEncObj CBOR_CONTEXT);
+	COSE_Sign_Sign(hEncObj, NULL);
 
 	cb = COSE_Encode((HCOSE)hEncObj, NULL, 0, 0) + 1;
 	rgb = (byte *)malloc(cb);
@@ -206,19 +209,19 @@
 	/* */
 
 	int typ;
-	hEncObj = (HCOSE_SIGN)COSE_Decode(rgb, (int)cb, &typ, COSE_sign_object, NULL CBOR_CONTEXT);
+	hEncObj = (HCOSE_SIGN)COSE_Decode(rgb, (int)cb, &typ, COSE_sign_object, NULL, NULL);
 
 #if 0
 	int iRecipient = 0;
 	do {
 		HCOSE_RECIPIENT hRecip;
 
-		hRecip = COSE_Encrypt_GetRecipient(hEncObj, iRecipient CBOR_CONTEXT);
+		hRecip = COSE_Encrypt_GetRecipient(hEncObj, iRecipient, NULL);
 		if (hRecip == NULL) break;
 
-		COSE_Recipient_SetKey(hRecip, rgbSecret, cbSecret CBOR_CONTEXT);
+		COSE_Recipient_SetKey(hRecip, rgbSecret, cbSecret, NULL);
 
-		COSE_Encrypt_decrypt(hEncObj, hRecip CBOR_CONTEXT);
+		COSE_Encrypt_decrypt(hEncObj, hRecip, NULL);
 
 		iRecipient += 1;
 
@@ -232,7 +235,7 @@
 
 int EncryptMessage()
 {
-	HCOSE_ENCRYPT hEncObj = COSE_Encrypt_Init(NULL CBOR_CONTEXT);
+	HCOSE_ENCRYPT hEncObj = COSE_Encrypt_Init(CBOR_CONTEXT_PARAM_COMMA NULL);
 	byte rgbSecret[128 / 8] = { 'a', 'b', 'c' };
 	int cbSecret = 128/8;
 	byte  rgbKid[6] = { 'a', 'b', 'c', 'd', 'e', 'f' };
@@ -242,13 +245,13 @@
 	char * sz = "This is the content to be used";
 
 
-	COSE_Encrypt_map_put(hEncObj, COSE_Header_Algorithm, cn_cbor_int_create(COSE_Algorithm_AES_CCM_16_64_128, NULL CBOR_CONTEXT), COSE_PROTECT_ONLY CBOR_CONTEXT);
-	COSE_Encrypt_SetContent(hEncObj, (byte *) sz, strlen(sz) CBOR_CONTEXT);
-	COSE_Encrypt_map_put(hEncObj, COSE_Header_IV, cn_cbor_data_create(rgbKid, cbKid, NULL CBOR_CONTEXT), COSE_UNPROTECT_ONLY CBOR_CONTEXT);
+	COSE_Encrypt_map_put(hEncObj, COSE_Header_Algorithm, cn_cbor_int_create(COSE_Algorithm_AES_CCM_16_64_128, NULL, NULL), COSE_PROTECT_ONLY, NULL);
+	COSE_Encrypt_SetContent(hEncObj, (byte *) sz, strlen(sz), NULL);
+	COSE_Encrypt_map_put(hEncObj, COSE_Header_IV, cn_cbor_data_create(rgbKid, cbKid, NULL, NULL), COSE_UNPROTECT_ONLY, NULL);
 
-	COSE_Encrypt_add_shared_secret(hEncObj, COSE_Algorithm_Direct, rgbSecret, cbSecret, rgbKid, cbKid CBOR_CONTEXT);
+	COSE_Encrypt_add_shared_secret(hEncObj, COSE_Algorithm_Direct, rgbSecret, cbSecret, rgbKid, cbKid, NULL);
 
-	COSE_Encrypt_encrypt(hEncObj CBOR_CONTEXT);
+	COSE_Encrypt_encrypt(hEncObj, NULL);
 
 	cb = COSE_Encode((HCOSE)hEncObj, NULL, 0, 0) +1;
 	rgb = (byte *)malloc(cb);
@@ -275,18 +278,18 @@
 	/* */
 
 	int typ;
-	hEncObj = (HCOSE_ENCRYPT) COSE_Decode(rgb, (int) cb, &typ, COSE_enveloped_object, NULL CBOR_CONTEXT);
+	hEncObj = (HCOSE_ENCRYPT) COSE_Decode(rgb, (int) cb, &typ, COSE_enveloped_object, NULL, NULL);
 	
 	int iRecipient = 0;
 	do {
 		HCOSE_RECIPIENT hRecip;
 
-		hRecip = COSE_Encrypt_GetRecipient(hEncObj, iRecipient CBOR_CONTEXT);
+		hRecip = COSE_Encrypt_GetRecipient(hEncObj, iRecipient, NULL);
 		if (hRecip == NULL) break;
 
-		COSE_Recipient_SetKey(hRecip, rgbSecret, cbSecret CBOR_CONTEXT);
+		COSE_Recipient_SetKey(hRecip, rgbSecret, cbSecret, NULL);
 
-		COSE_Encrypt_decrypt(hEncObj, hRecip CBOR_CONTEXT);
+		COSE_Encrypt_decrypt(hEncObj, hRecip, NULL);
 
 		iRecipient += 1;
 
@@ -302,7 +305,7 @@
 	const cn_cbor * pControl = NULL;
 
 	for (i = 1; i < argc; i++) {
-		if (argv[0] == '-') {
+		if (argv[0][0] == '-') {
 
 		}
 		else {