Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted to not mix programming paradigms. #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions spec/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -1052,45 +1052,46 @@ Libsodium is a popularly available open source software library that is a fork o

Per [[spec-norm:libsodium]] documentation, the combined mode API defined in `C` is as follows.

``` text
``` c
int crypto_box_seal(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *pk);
```
`crypto_box_seal()` encrypts plaintext `m` of length `mlen` using the receiver's public key `pk`, and outputs to buffer `c` the ciphertext.

``` text
``` c
int crypto_box_seal_open(unsigned char *m, const unsigned char *c,
unsigned long long clen,
const unsigned char *pk, const unsigned char *sk);
```
`crypto_box_seal_open()` decrypts the ciphertext `c` of length `clen` using the sender's public key `pk` and the receiver's secret key `sk`, and outputs the plaintext to `m`.

##### TSP USE of Sealed Box for PKAE
##### TSP Use of Sealed Box for PKAE

To use sealed box as the PKAE in TSP, for TSP message that uses confidential payload, the ciphertext MUST generated by `crypto_box_seal()` API as follows or an equivalent procedure:
To use sealed box as the PKAE in TSP, for TSP message that uses confidential payload, the ciphertext MUST generated by `crypto_box_seal()` API as follows (in pseudocode) or an equivalent procedure:

``` text
def TSP_SEAL(VID_sndr, VID_rcvr, Non_Confidential_Fields, Confidential_Fields_Plaintext):
pkR = VID_rcvr.PK_e
pt = Confidential_Fields_Plaintext
mlen = lengthof(pt)
crypto_box_seal(&ct, &pt, mlen, &pkR)
return ct
mlen = Length(pt)
ciphertext = crypto_box_seal(pt, mlen, pkR)
return ciphertext

Ciphertext = TSP_SEAL(VID_sndr, VID_rcvr,
Non_Confidential_Fields,
Confidential_Fields_Plaintext)
```

The receiver MUST use the corresponding `crypto_box_seal_open()` API or an equivalent procedure to decrypt:
The receiver MUST use the corresponding `crypto_box_seal_open()` API procedure or an equivalent to decrypt:

``` text
def TSP_OPEN(VID_sndr, VID_rcvr, Non_Confidential_Fields, Confidential_Fields_Ciphertext):
pkS = VID_sndr.PK_e
skR = VID_rcvr.SK_e
ct = Confidential_Fields_Ciphertext
clen = lengthof(ct)
crypto_box_seal_open(&output, &ct, clen, &pkS, &skR)
clen = Length(ct)
output = crypto_box_seal_open(ct, clen, pkS, skR)
return output

Plaintext = TSP_OPEN(VID_sndr, VID_rcvr,
Non_Confidential_Fields,
Expand Down