In essence, this method uses authenticated encryption to bind the message payload to the JWE envelope and authenticate the sender after the message has been decrypted.
While the inner message could be wrapped in a JWS in order to authenticate the sender, that would be considered non-repudiable.
ECDH-1PU allows for the sender key to be authenticated during the message decryption, but remains as a draft standard, and potentially exposes the sender's key identifier.
from_key
:{
"id": "518be002-de8e-456e-b3d5-8fe472477a86",
"type": "https://didcomm.org/trust_ping/1.0",
"from": "did:example:alice",
// 👇 new addition: corresponds to skid
"from_key": "#keyAgreement1",
"to": ["did:example:bob"],
"body": {
"response_requested": true
}
}
Convert the message to octets for input to the JWE wrapper.
For each recipient, perform a DH key exchange between the sender's private key and recipient's public key producing the shared key Z. Perform a ConcatKDF as per ECDH-ES, setting apu
and apv
to the sender and recipient key identifiers (from_key
and kid
respectively), producing a key in the same format as the intended CEK (AES256GCM / XC20P). Encrypt an empty (zero byte) message using the key, using the message plaintext as the additional authenticated data, to produce a sender authentication tag.
When preparing the message, add the authentication tag for each recipient to the header
attributes, encoded as unpadded base64-URL for example:
{"kid":"did:example:bob#key1","stag":"<tag>"}
Decrypt the JWE as per normal.
If from_key
is not present in the message or stag
is not included in the recipient header, consider the message unauthenticated (skip to end).
Perform a DH key exchange between the recipient's private key and the sender's public key and derive the sender authentication key via ConcatKDF. Encrypt a blank message using the derived key, using the message plaintext as additional authenticated data, to produce the sender authentication tag. Compare the result to the stag
value (use a constant time comparison). If it matches, consider the message authenticated.
skid
.skid
(but uses the same key exchanges).stag
attribute name is used here illustratively. Any eventual choice may need to be registered with IANA, made collision resistant, or recognized as a private header.or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing