1. 02 Dec, 2013 1 commit
    • ap@apple.com's avatar
      Add support for WebCrypto RSA-OAEP · a3d6e70d
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=125084
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/rsa-oaep-key-manipulation.html
             crypto/subtle/rsa-oaep-plaintext-length.html
             crypto/subtle/rsa-oaep-wrap-unwrap-aes.html
      
      * WebCore.xcodeproj/project.pbxproj: Added new files.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createRsaOaepParams):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
      Added RSA-OAEP parameters.
      
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm):
      (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid):
      (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON):
      Support RSA-OAEP in JWK. It is more limited than general WebCrypto, as JWK only
      allows SHA-1 as hash.
      
      * crypto/CommonCryptoUtilities.cpp: Added. (WebCore::getCommonCryptoDigestAlgorithm):
      * crypto/CommonCryptoUtilities.h: Added.
      Extracted some shared code and forward declarations for CommonCrypto.
      
      * crypto/CryptoAlgorithmParameters.h: (WebCore::CryptoAlgorithmParameters::Class):
      * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: Added.
      Added RsaOaepParams.
      
      * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: Added.
      * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: Added.
      * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: Added.
      
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::getCommonCryptoHMACAlgorithm):
      (WebCore::CryptoAlgorithmHMAC::platformSign):
      (WebCore::CryptoAlgorithmHMAC::platformVerify):
      * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
      * crypto/mac/CryptoKeyMac.cpp:
      * crypto/mac/CryptoKeyRSAMac.cpp:
      Use CommonCryptoUtilities.
      
      * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
      (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register RSA-OAEP.
      
      LayoutTests: 
      
      * crypto/subtle/rsa-oaep-key-manipulation-expected.txt: Added.
      * crypto/subtle/rsa-oaep-key-manipulation.html: Added.
      * crypto/subtle/rsa-oaep-plaintext-length-expected.txt: Added.
      * crypto/subtle/rsa-oaep-plaintext-length.html: Added.
      * crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt: Added.
      * crypto/subtle/rsa-oaep-wrap-unwrap-aes.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a3d6e70d