Supply a SPK if spk_kid is present
diff --git a/src/Recipient.c b/src/Recipient.c
index a09a34a..8013928 100644
--- a/src/Recipient.c
+++ b/src/Recipient.c
@@ -1070,3 +1070,24 @@
 	goto returnHere;
 }
 
+/*! brief Retrieve header parameter from a recipient structure
+*
+* Retrieve a header parameter from the message.
+* Retrieved object is the same as the one in the message - do not delete it
+*
+* @param[in]	h	Handle of recipient object
+* @param[in]    key	Key to look for
+* @param[in]	flags	What buckets should we look for the message
+* @param[out]	perror	Location to return error codes
+* @return	Object which is found or NULL
+*/
+
+cn_cbor * COSE_Recipient_map_get_int(HCOSE_RECIPIENT h, int key, int flags, cose_errback * perror)
+{
+	if (!IsValidRecipientHandle(h)) {
+		if (perror != NULL) perror->err = COSE_ERR_INVALID_HANDLE;
+		return NULL;
+	}
+
+	return _COSE_map_get_int(&((COSE_RecipientInfo *)h)->m_encrypt.m_message, key, flags, perror);
+}
diff --git a/test/encrypt.c b/test/encrypt.c
index 53d0103..afe4554 100644
--- a/test/encrypt.c
+++ b/test/encrypt.c
@@ -65,6 +65,13 @@
 
 		if (!SetReceivingAttributes((HCOSE) hRecip, pRecipients, Attributes_Recipient_protected)) goto errorReturn;
 
+		cn_cbor * cnStatic = cn_cbor_mapget_string(pRecipients, "sender_key");
+		if (cnStatic != NULL) {
+			if (COSE_Recipient_map_get_int(hRecip, COSE_Header_ECDH_SPK, COSE_BOTH, NULL) == 0) {
+				COSE_Recipient_map_put(hRecip, COSE_Header_ECDH_SPK, BuildKey(cnStatic, true), COSE_DONT_SEND, NULL);
+			}
+		}
+
 		pFail = cn_cbor_mapget_string(pRecipients, "fail");
 		if (COSE_Enveloped_decrypt(hEnc, hRecip, NULL)) {
 			if ((pFail != NULL) && (pFail->type != CN_CBOR_TRUE)) fFail = true;
diff --git a/test/mac_test.c b/test/mac_test.c
index 35014c5..cd0c538 100644
--- a/test/mac_test.c
+++ b/test/mac_test.c
@@ -61,6 +61,13 @@
 			continue;
 		}
 
+		cn_cbor * cnStatic = cn_cbor_mapget_string(pRecipients, "sender_key");
+		if (cnStatic != NULL) {
+			if (COSE_Recipient_map_get_int(hRecip, COSE_Header_ECDH_SPK, COSE_BOTH, NULL) == 0) {
+				COSE_Recipient_map_put(hRecip, COSE_Header_ECDH_SPK, BuildKey(cnStatic, true), COSE_DONT_SEND, NULL);
+			}
+		}
+
 		pFail = cn_cbor_mapget_string(pRecipients, "fail");
 		if (COSE_Mac_validate(hMAC, hRecip, NULL)) {
 			if ((pFail != NULL) && (pFail->type != CN_CBOR_TRUE)) fFail = true;