Bug 124483

Summary: Support exporting private WebCrypto RSA keys
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: WebCore Misc.Assignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 122679    
Attachments:
Description Flags
proposed patch andersca: review+

Description Alexey Proskuryakov 2013-11-18 00:43:33 PST
The difficulty here is that CommonCrypto functions don't expose all key parts necessary for JWK, so we'll need to compute them from prime factors manually.
Comment 1 Alexey Proskuryakov 2013-12-03 12:10:58 PST
Created attachment 218322 [details]
proposed patch
Comment 2 Anders Carlsson 2013-12-03 12:13:25 PST
Comment on attachment 218322 [details]
proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=218322&action=review

> Source/WebCore/crypto/CommonCryptoUtilities.cpp:82
> +    RELEASE_ASSERT(!status);

I’d rather assert status == kCCSuccess here (and all the other places).
Comment 3 WebKit Commit Bot 2013-12-03 12:13:30 PST
Attachment 218322 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/crypto/subtle/rsa-export-private-key-expected.txt', u'LayoutTests/crypto/subtle/rsa-export-private-key.html', u'Source/WebCore/ChangeLog', u'Source/WebCore/crypto/CommonCryptoUtilities.cpp', u'Source/WebCore/crypto/CommonCryptoUtilities.h', u'Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp']" exit_code: 1
ERROR: Source/WebCore/crypto/CommonCryptoUtilities.cpp:32:  Missing spaces around /  [whitespace/operators] [3]
ERROR: Source/WebCore/crypto/CommonCryptoUtilities.h:100:  Missing spaces around &&  [whitespace/operators] [3]
ERROR: Source/WebCore/crypto/CommonCryptoUtilities.h:102:  Missing spaces around &&  [whitespace/operators] [3]
Total errors found: 3 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Alexey Proskuryakov 2013-12-03 12:15:37 PST
Committed <http://trac.webkit.org/r160029>.
Comment 5 Alexey Proskuryakov 2013-12-03 12:16:53 PST
> I’d rather assert status == kCCSuccess here (and all the other places).

These pretty much only fail on out of memory conditions, which is normally a release assert for us.
Comment 6 Alexey Proskuryakov 2013-12-03 12:18:18 PST
Or did you mean a RELEASE_ASSERT in a different form? I personally prefer "status == kCCSuccess" too, but I don't think we ever do that for other types.
Comment 7 Anders Carlsson 2013-12-03 12:19:01 PST
(In reply to comment #6)
> Or did you mean a RELEASE_ASSERT in a different form? I personally prefer "status == kCCSuccess" too, but I don't think we ever do that for other types.

I mean i like the condition to be (status == kCCSuccess) as opposed to (!status) since it’s not clear (to me anyway) that kCCSuccess is 0.