Support exporting private WebCrypto RSA keys
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2013 20:18:14 +0000 (20:18 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2013 20:18:14 +0000 (20:18 +0000)
commit73dd34ebeb4935382ef25e1fbdc9b63dd3e59f2d
treee7202ecb12450ad4934032c26c12273e83836ff9
parent3903be9b08f62c7d7feda7f86484d885e03a9bb4
Support exporting private WebCrypto RSA keys
https://bugs.webkit.org/show_bug.cgi?id=124483

Reviewed by Anders Carlsson.

Source/WebCore:

Test: crypto/subtle/rsa-export-private-key.html

It might be better to have our own bignum implementation in WTF, but we currently
don't, and the need for this computation is Common Crypto specific anyway.

* crypto/CommonCryptoUtilities.h:
* crypto/CommonCryptoUtilities.cpp:
(WebCore::CCBigNum::CCBigNum):
(WebCore::CCBigNum::~CCBigNum):
(WebCore::CCBigNum::operator=):
(WebCore::CCBigNum::data):
(WebCore::CCBigNum::operator-):
(WebCore::CCBigNum::operator%):
(WebCore::CCBigNum::inverse):
Added a minimal wrapper around CommonCrypto BigNum.

* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::getPrivateKeyComponents): Compute missing parts using CCBigNum.
(WebCore::CryptoKeyRSA::exportData): Implemented private key case.

LayoutTests:

* crypto/subtle/rsa-export-private-key-expected.txt: Added.
* crypto/subtle/rsa-export-private-key.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160029 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/crypto/subtle/rsa-export-private-key-expected.txt [new file with mode: 0644]
LayoutTests/crypto/subtle/rsa-export-private-key.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/crypto/CommonCryptoUtilities.cpp
Source/WebCore/crypto/CommonCryptoUtilities.h
Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp