diff --git a/cloudevents/spec.md b/cloudevents/spec.md index ad4513d8..9a98c664 100644 --- a/cloudevents/spec.md +++ b/cloudevents/spec.md @@ -13,7 +13,7 @@ data. - [Event Data](#event-data) - [Size Limits](#size-limits) - [Privacy & Security](#privacy-and-security) -- [Example](#example) +- [Example](#examples) ## Overview @@ -608,9 +608,9 @@ Consider the following to prevent inadvertent leakage especially when leveraging Protocol level security SHOULD be employed to ensure the trusted and secure exchange of CloudEvents. -## Example +## Examples -The following example shows a CloudEvent serialized as JSON: +### Example of a CloudEvent with extension fields ```JSON { @@ -626,3 +626,67 @@ The following example shows a CloudEvent serialized as JSON: "data" : "" } ``` + +### Example of a CloudEvent with JOSE encrypted data + +For JOSE spec please see https://datatracker.ietf.org/doc/rfc7516/ + +This example does not imply that CloudEvents has some inherent security features. +The example shows how data can be encrypted thus achieving confidentiality. +Security features are intentionally out-of-scope in this spec. +The choice of encryption method and format is domain specific. + +The following example shows a CloudEvent serialized as JSON with line-breaks +for display purposes only: + +``` +{ + "specversion" : "1.0", + "type" : "PAYMENT.AUTHORIZATION.CREATED", + "source" : "https://paymentprocessor.example.com/", + "subject" : "c7bbb040-d458-4d47-82a8-45413f9f2d33", + "id" : "a978702e-ef48-4032-ac18-a057e0104076", + "time" : "2024-05-30T17:31:00Z", + "datacontenttype" : "application/jose", + "data" : "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ. + OKOawDo13gRp2ojaHV7LFpZcgV7T6DVZKTyKOMTYUmKoTCVJRgckCL9kiMT03JGe + ipsEdY3mx_etLbbWSrFr05kLzcSr4qKAq7YN7e9jwQRb23nfa6c9d-StnImGyFDb + Sv04uVuxIp5Zms1gNxKKK2Da14B8S4rzVRltdYwam_lDp5XnZAYpQdb76FdIKLaV + mqgfwX7XWRxv2322i-vDxRfqNzo_tETKzpVLzfiwQyeyPGLBIO56YJ7eObdv0je8 + 1860ppamavo35UgoRdbYaBcoh9QcfylQr66oc6vFWXRcZ_ZT2LawVCWTIy3brGPi + 6UklfCpIMfIjf7iGdXKHzg. + 48V1_ALb6US04U3b. + 5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji + SdiwkIr3ajwQzaBtQD_A. + XFBoMYUZodetZdvTiFvSkQ" +} +``` + + +### Example of a CloudEvent with xmlenc encrypted data + +For xmlenc spec please see [xmlenc](https://www.w3.org/TR/xmlenc-core1/) + +This example does not imply that CloudEvents has some inherent security features. +The example shows how data can be encrypted thus achieving confidentiality. +Security features are intentionally out-of-scope in this spec. +The choice of encryption method and format is domain specific. + +The following example shows a CloudEvent serialized as xmlenc with line-breaks +for display purposes only: + +``` +{ + "specversion" : "1.0", + "type" : "PAYMENT.AUTHORIZATION.CREATED", + "source" : "https://paymentprocessor.example.com/", + "subject" : "c7bbb040-d458-4d47-82a8-45413f9f2d33", + "id" : "a978702e-ef48-4032-ac18-a057e0104076", + "time" : "2024-05-30T17:31:00Z", + "datacontenttype" : "application/xenc+xml", + "data" : " + A23B45C56 + " +} +```