Skip to content

Allow web applications to select SFrame cipher suite as a parameter provided to SFrameTransform constructor. #257

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

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
33 changes: 19 additions & 14 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ spec:webidl; type:dfn; text:resolve
</pre>
<pre class=biblio>
{
"SFRAME": {
"href":
"https://www.ietf.org/archive/id/draft-ietf-sframe-enc-04.html",
"title": "Secure Frame (SFrame)"
},
"VP9": {
"href":
"https://storage.googleapis.com/downloads.webmproject.org/docs/vp9/vp9-bitstream-specification-v0.6-20160331-draft.pdf",
Expand Down Expand Up @@ -221,7 +216,7 @@ Similarly, if a web application sets the transform synchronously at creation of
# SFrameTransform # {#sframe}

<p>
The API presented in this section allows applications to process SFrame data as defined in [[SFrame]].
The API presented in this section allows applications to process SFrame data as defined in [[RFC9605]].
</p>

<xmp class="idl">
Expand All @@ -230,8 +225,17 @@ enum SFrameTransformRole {
"decrypt"
};

enum SFrameCipherSuite {
"AES_128_CTR_HMAC_SHA256_80",
"AES_128_CTR_HMAC_SHA256_64",
"AES_128_CTR_HMAC_SHA256_32",
"AES_128_GCM_SHA256_128",
"AES_256_GCM_SHA512_128"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these particular ciphersuites? If they're defined by 9605 section 4.5 and no others can be used, we should be sure to say so.

Should there be an MTI ciphersuite?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These cipher suites are indeed the ones defined by RFC 9605.
No other can be used given we use an enumeration here.

I would think that all cipher suites are MTI if a UA implements SFrameTransform.

};

dictionary SFrameTransformOptions {
SFrameTransformRole role = "encrypt";
required SFrameCipherSuite cipherSuite;
};

typedef [EnforceRange] unsigned long long SmallCryptoKeyID;
Expand Down Expand Up @@ -269,12 +273,13 @@ dictionary SFrameTransformErrorEventInit : EventInit {

The <dfn constructor for="SFrameTransform" lt="SFrameTransform(options)"><code>new SFrameTransform(<var>options</var>)</code></dfn> constructor steps are:
1. Let |transformAlgorithm| be an algorithm which takes a |frame| as input and runs the <a href="#sframe-transform-algorithm">SFrame transform algorithm</a> with |this| and |frame|.
2. Set |this|.`[[transform]]` to a new {{TransformStream}}.
3. <a dfn for="ReadableStream">Set up</a> [=this=].`[[transform]]` with [=TransformStream/set up/transformAlgorithm=] set to |transformAlgorithm|.
4. Let |options| be the method's first argument.
5. Set |this|.`[[role]]` to |options|["{{SFrameTransformOptions/role}}"].
6. Set |this|.`[[readable]]` to |this|.`[[transform]]`.`[[readable]]`.
7. Set |this|.`[[writable]]` to |this|.`[[transform]]`.`[[writable]]`.
1. Set |this|.`[[transform]]` to a new {{TransformStream}}.
1. <a dfn for="ReadableStream">Set up</a> [=this=].`[[transform]]` with [=TransformStream/set up/transformAlgorithm=] set to |transformAlgorithm|.
1. Let |options| be the method's first argument.
1. Set |this|.`[[role]]` to |options|["{{SFrameTransformOptions/role}}"].
1. Set |this|.`[[cipherSuite]]` to |options|["{{SFrameTransformOptions/cipherSuite}}"].
1. Set |this|.`[[readable]]` to |this|.`[[transform]]`.`[[readable]]`.
1. Set |this|.`[[writable]]` to |this|.`[[transform]]`.`[[writable]]`.

## Algorithm ## {#sframe-transform-algorithm}

Expand All @@ -287,7 +292,7 @@ The SFrame transform algorithm, given |sframe| as a SFrameTransform object and |
1. If |frame| is a {{RTCEncodedAudioFrame}}, set |data| to |frame|.{{RTCEncodedAudioFrame/data}}
1. If |frame| is a {{RTCEncodedVideoFrame}}, set |data| to |frame|.{{RTCEncodedVideoFrame/data}}
1. If |data| is undefined, abort these steps.
1. Let |buffer| be the result of running the SFrame algorithm with |data| and |role| as parameters. This algorithm is defined by the <a href="https://datatracker.ietf.org/doc/draft-omara-sframe/">SFrame specification</a> and returns an {{ArrayBuffer}}.
1. Let |buffer| be the result of running the SFrame algorithm with |data|, |sframe|.`[[cipherSuite]]`, and |role| as parameters. This algorithm is defined by [[RFC9605]] and returns an {{ArrayBuffer}}.
1. If the SFrame algorithm exits abruptly with an error, [=queue a task=] to run the following sub steps:
1. If the processing fails on decryption side due to |data| not following the SFrame format, [=fire an event=] named {{SFrameTransform/onerror|error}} at |sframe|,
using the {{SFrameTransformErrorEvent}} interface with its {{SFrameTransformErrorEvent/errorType}} attribute set to {{SFrameTransformErrorEventType/syntax}}
Expand All @@ -309,7 +314,7 @@ The <dfn method for="SFrameTransform">setEncryptionKey(|key|, |keyID|)</dfn> met
1. Let |promise| be [=a new promise=].
2. If |keyID| is a {{bigint}} which cannot be represented as a integer between 0 and 2<sup>64</sup>-1 inclusive, [=reject=] |promise| with a {{RangeError}} exception.
3. Otherwise, [=in parallel=], run the following steps:
1. Set |key| with its optional |keyID| as key material to use for the SFrame transform algorithm, as defined by the <a href="https://datatracker.ietf.org/doc/draft-omara-sframe/">SFrame specification</a>.
1. Set |key| with its optional |keyID| as key material to use for the SFrame transform algorithm, as defined by [[RFC9605]].
2. If setting the key material fails, [=reject=] |promise| with an {{InvalidModificationError}} exception and abort these steps.
3. [=Resolve=] |promise| with undefined.
4. Return |promise|.
Expand Down