Skip to content
  • ap@apple.com's avatar
    Support exporting private WebCrypto RSA keys · 902a179d
    ap@apple.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@160029 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    902a179d