Skip to content

Whether KeyingMaterial internal slot can be stored and retrieved #1723

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

Closed
wants to merge 6 commits into from

Conversation

aboba
Copy link
Contributor

@aboba aboba commented Jan 8, 2018

Clarification for Issues #1694 and #1739

@aboba aboba requested review from martinthomson and fluffy January 8, 2018 21:21
@aboba
Copy link
Contributor Author

aboba commented Jan 8, 2018

@ekr Can you review?

webrtc.html Outdated
@@ -4626,7 +4626,8 @@ <h2>Methods</h2>
contains unstructured binary data.</p>
<p>Note that an <code>RTCCertificate</code> might not directly hold
private keying material, this might be stored in a secure module.</p>
<p>The <code>RTCCertificate</code> object can be stored and retrieved
<p>The <code>RTCCertificate</code> object, with the exception of the
the <a>[[\KeyingMaterial]]</a> internal slot, can be stored and retrieved
Copy link
Member

Choose a reason for hiding this comment

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

This isn't necessary. The object can be stored and retrieved, including the KeyingMaterial internal slot.

Firefox implements this. An RTCCertificate can be stored to indexedDB and later retrieved and used. This is exactly the same process that we use for keys in WebCrypto. See https://w3c.github.io/webcrypto/Overview.html#concepts-key-storage

Copy link
Contributor

Choose a reason for hiding this comment

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

So the keying material can be stored on storage that is persistent to the browser, but there's no way of getting it out so that it can be accessed by the Javascript client, is that right?
#1694 was complaining about using the word "persistent" for that kind of storage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If private keying material is held in a secure module, does this affect the ability to store and retrieve the KeyingMaterial internal slot? Just trying to understand what the requirements are for storing and retrieving certificates. Typically the term "persistent" implies the ability to persist across reboots.

Copy link
Member

Choose a reason for hiding this comment

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

What happens here is that the keying material is stored however the browser can. If it is in a secure module, the browser needs to store a handle to the stored keying material so that it can be used again. If the secure module goes away, then it won't be available until it comes back. It's still persistent though in the sense that if the machine reboots, it's still there unless the user explicitly wipes the storage (or the module).

Javascript can never directly use these keys, it can only ask the browser to use them in certain predefined ways. Just as the browser can't use the keys directly if there is a secure module in use, it can only ask the secure module to use them in predefined ways. For these keys, they can only be used to make new WebRTC connections.

Copy link
Contributor

@fluffy fluffy left a comment

Choose a reason for hiding this comment

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

LGTM

@alvestrand alvestrand mentioned this pull request Jan 18, 2018
webrtc.html Outdated
<code>RTCCertificate</code> might not directly hold
private keying material, this might be stored in a secure module,
in which case the <a>[[\KeyingMaterial]]</a> internal slot might not
be storable and retrievable. When a <a>user agent</a> is
Copy link
Contributor

Choose a reason for hiding this comment

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

If we store it and retrieve it on the same host, would we assume that the KSM can still be accessed?

Copy link
Contributor

Choose a reason for hiding this comment

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

all the web crpto seem pretty vague about this. I think the answer is "maybe". AFAIC this is all way under specified. So for example, if the user and told the browser to clear the locally storage, it would almost certainly be gone - I think it is often tied to saving in a one of the web databases / local storage options. So if that is gone, it is probably gone even if it is still in the KSM. How memory on the KSM is ever reclaimed is not clear to me. But .... I don't think we can fix this in WebRTC spec.

@aboba
Copy link
Contributor Author

aboba commented Feb 22, 2018

@fluffy @martinthomson Can you review at the updated PR?

@martinthomson
Copy link
Member

The current text implies that the private keys would need to be extracted from the KSM when doing a structured clone. That's not possible in the general case. I think that instead we need some sort of failure mode for the case when one of these is used. That would also cover the case where you made a cert and the KSM with the private key was removed/flushed before use.

webrtc.html Outdated
represents a handle to both the certificate and the private key,
implementations MUST support storing and retrieving both the certificate
and private key, even if the <code>RTCCertificate</code> stores the private
key in a secure module. When a <a>user agent</a> is required to obtain a
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested text:
Note that there is no way to access the private key, so it doesn't matter to the user whether the private key is stored directly or if it is stored as a reference to some other key storage such as a KSM.

@aboba
Copy link
Contributor Author

aboba commented Mar 1, 2018

@martinthomson @alvestrand PR updated to clarify that the [[KeyingMaterial]] slot is not accessible by the application, and could represent a reference to the key material stored in a KSM, permitting storage and retrieval as well as structured cloning.

webrtc.html Outdated
directly hold private keying material (it might be stored in a
secure module), a reference to the private key can be held in
the <a>[[\KeyingMaterial]]</a> internal slot, allowing the
private key to be stored and retrieved.</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps change "retrieved" to "used"

@alvestrand
Copy link
Contributor

See also #1089

aboba added a commit that referenced this pull request Mar 14, 2018
Rebase of #1723

Clarification for Issues #1694 and #1739

See also #1089
@aboba aboba closed this Mar 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants