WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 165367
Bug 164868
CryptoKeyPair objects should be dictionaries - and not a distinct object type - making them structured cloneable
https://bugs.webkit.org/show_bug.cgi?id=164868
Summary
CryptoKeyPair objects should be dictionaries - and not a distinct object type...
Jason Mei
Reported
2016-11-17 08:09:49 PST
Created
attachment 295050
[details]
stand alone html that shows the problem There is a problem adding the CryptoKeyPair object into indexedDB. I have attached a html test case that shows this problem. This code works in Chrome and Firefox. Neither browser returns a CryptoKeyPair, and instead returns a plain object.
Attachments
stand alone html that shows the problem
(3.64 KB, text/html)
2016-11-17 08:09 PST
,
Jason Mei
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-11-17 09:38:55 PST
<
rdar://problem/29312605
>
Brady Eidson
Comment 2
2016-11-17 11:21:00 PST
> This code works in Chrome and Firefox.
but then
> Neither browser returns a CryptoKeyPair, and instead returns a plain object.
This makes no sense to me. If it truly works, it would have to also *return* a CryptoKeyPair. Are you sure CryptoKeyPair is actually serializable WRT the structured clone algorithm? (I haven't looked into it yet)
Brady Eidson
Comment 3
2016-11-17 11:22:30 PST
(In reply to
comment #2
)
> > This code works in Chrome and Firefox. > > but then > > > Neither browser returns a CryptoKeyPair, and instead returns a plain object. > > This makes no sense to me. > If it truly works, it would have to also *return* a CryptoKeyPair. > > Are you sure CryptoKeyPair is actually serializable WRT the structured clone > algorithm? > > (I haven't looked into it yet)
The error we throw: DataCloneError "An object could not be cloned" This strongly suggests that CryptoKeyPairs are not structured cloneable, and therefore are not allowed to be stored in IDB
Brady Eidson
Comment 4
2016-11-17 11:28:37 PST
Also, you state this is a regression, but it is not: Safari 9 also shows the DataCloneError
Brady Eidson
Comment 5
2016-11-17 11:38:17 PST
The current spec for WebCrypto:
https://w3c.github.io/webcrypto/Overview.html#cryptokey-interface-clone
Specifies the Structured Clone Algorithm for "CryptoKey" objects. It does *not* specify the Structured Clone Algorithm for "CryptoKeyPair" objects. Additionally, the WebCrypto spec explicitly calls out the fact that CryptoKeys should be storable in IndexedDB, but not CryptoKeyPairs.
Brady Eidson
Comment 6
2016-11-17 11:39:13 PST
Basically, until somebody finds a standard that specifies the Structured Clone Algorithm for CryptoKeyPair objects, they absolutely should not be storable in IndexedDB.
Brady Eidson
Comment 7
2016-11-17 11:44:06 PST
I believe the reason Chrome and Firefox allow the put is that they do not recognize the CryptoKeyPair as a "CryptoKeyPair" - They think it's an "Object" And "Objects" are structured cloneable as long as each of their properties are.
Brady Eidson
Comment 8
2016-11-17 11:46:42 PST
(In reply to
comment #7
)
> I believe the reason Chrome and Firefox allow the put is that they do not > recognize the CryptoKeyPair as a "CryptoKeyPair" - They think it's an > "Object" > > And "Objects" are structured cloneable as long as each of their properties > are.
Got it. At one point in the history of the spec, CryptoKeyPair objects were their own interface, therefore their own explicit object type. Now they're just an object dictionary (
https://w3c.github.io/webcrypto/Overview.html#keypair
), which means they are an "Object", which means they are structured cloneable
Brady Eidson
Comment 9
2016-11-17 11:47:06 PST
(In reply to
comment #8
)
> (In reply to
comment #7
) > > I believe the reason Chrome and Firefox allow the put is that they do not > > recognize the CryptoKeyPair as a "CryptoKeyPair" - They think it's an > > "Object" > > > > And "Objects" are structured cloneable as long as each of their properties > > are. > > Got it. > > At one point in the history of the spec, CryptoKeyPair objects were their > own interface, therefore their own explicit object type. > > Now they're just an object dictionary > (
https://w3c.github.io/webcrypto/Overview.html#keypair
), which means they > are an "Object", which means they are structured cloneable
Fixing this is just a matter of fixing our IDL situation for CryptoKeyPair.
Brady Eidson
Comment 10
2016-12-02 13:57:35 PST
This will be resolved as part of
https://bugs.webkit.org/show_bug.cgi?id=163711
*** This bug has been marked as a duplicate of
bug 163711
***
Jiewen Tan
Comment 11
2016-12-02 15:33:50 PST
We need a specific hack for this as
Bug 163711
will not be resolved in a short term.
Jiewen Tan
Comment 12
2016-12-07 11:41:27 PST
*** This bug has been marked as a duplicate of
bug 165367
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug