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
  2. 15 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Update WebCrypto tests · df32d58c
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124388
      
      Reviewed by Anders Carlsson.
      
      Updated tests for newer common.js. Changed some tests from just dumping results
      to comparing them to known expected ones. Fixed a syntax error in
      aes-cbc-invalid-length.html, so it now actually runs.
      
      * crypto/subtle/resources/common.js: Update to a new version from Blink, because
      it's much nicer than the old one, and it's good to be compatible at test level.
      Moved crypto.subtle definition from webkitSubtle here to avoid repeating it in all
      tests. Added a quick and dirty Promise.all implementation.
      
      * crypto/subtle/aes-cbc-192-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-192-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-generate-key.html:
      * crypto/subtle/aes-cbc-import-jwk-expected.txt:
      * crypto/subtle/aes-cbc-import-jwk.html:
      * crypto/subtle/aes-cbc-invalid-length-expected.txt:
      * crypto/subtle/aes-cbc-invalid-length.html:
      * crypto/subtle/aes-cbc-wrong-key-class.html:
      * crypto/subtle/aes-export-key-expected.txt:
      * crypto/subtle/aes-export-key.html:
      * crypto/subtle/argument-conversion-expected.txt:
      * crypto/subtle/argument-conversion.html:
      * crypto/subtle/hmac-export-key-expected.txt:
      * crypto/subtle/hmac-export-key.html:
      * crypto/subtle/hmac-generate-key.html:
      * crypto/subtle/hmac-import-jwk-expected.txt:
      * crypto/subtle/hmac-import-jwk.html:
      * crypto/subtle/hmac-sign-verify-empty-key-expected.txt:
      * crypto/subtle/hmac-sign-verify-empty-key.html:
      * crypto/subtle/hmac-sign-verify-expected.txt:
      * crypto/subtle/hmac-sign-verify.html:
      * crypto/subtle/import-jwk-expected.txt:
      * crypto/subtle/import-jwk.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt:
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt:
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt:
      * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html:
      * crypto/subtle/sha-1-expected.txt:
      * crypto/subtle/sha-1.html:
      * crypto/subtle/sha-224-expected.txt:
      * crypto/subtle/sha-224.html:
      * crypto/subtle/sha-256-expected.txt:
      * crypto/subtle/sha-256.html:
      * crypto/subtle/sha-384-expected.txt:
      * crypto/subtle/sha-384.html:
      * crypto/subtle/sha-512-expected.txt:
      * crypto/subtle/sha-512.html:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      df32d58c
  3. 13 Nov, 2013 4 commits
    • ap@apple.com's avatar
      Implement key generation and JWK import for RSASSA-PKCS1-v1_5 · a237529b
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124236
      
      Reviewed by Sam Weinig.
      
      Source/WebCore:
      
      Tests: crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html
             crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html
      
      * WebCore.xcodeproj/project.pbxproj: Added new files.
      
      * bindings/js/JSCryptoAlgorithmBuilder.cpp:
      (WebCore::JSCryptoAlgorithmBuilder::add):
      * bindings/js/JSCryptoAlgorithmBuilder.h:
      * crypto/CryptoAlgorithmDescriptionBuilder.h:
      Added a way to add an Uint8Array, as needed for RSA key.algorithm.publicExponent.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createAesCbcParams): Removed unneeded JSC prefixes.
      (WebCore::createAesKeyGenParams): Ditto.
      (WebCore::createHmacParams): Ditto.
      (WebCore::createHmacKeyParams): Ditto.
      (WebCore::createRsaKeyGenParams): Added.
      (WebCore::createRsaSsaKeyParams): Added. WebCrypto currently doesn't specify any
      parameters for importKey, so the structure remains blank (unlike with JWK).
      (WebCore::createRsaSsaParams): Added (currently unused, will be sued for sign/verify soon).
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Added support for RSAES_PKCS1_v1_5.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Added support for RSAES_PKCS1_v1_5.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForWrapKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForUnwrapKey): Ditto.
      
      * bindings/js/JSCryptoKeySerializationJWK.h:
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::getJSArrayFromJSON): Added.
      (WebCore::getBigIntegerVectorFromJSON): Added.
      (WebCore::createRSASSAKeyParameters): Create parameters for key import. The key
      will remember which algorithm it's allowed to be used with.
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): Added support for
      RS256...RS512 (tha is, RSAES_PKCS1_v1_5 with SHA-256...SHA-512).
      (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence): Split out of keyData().
      (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): Added code to read
      RSA key components from JWK.
      (WebCore::JSCryptoKeySerializationJWK::keyData): Call one of the above functions.
      
      * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: Added.
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
      Placeholders.
      
      * crypto/CryptoKey.h: (WebCore::CryptoKeyClass): Added RSA key class for poor man's RTTI.
      
      * crypto/CryptoKeyData.h: (WebCore::CryptoKeyData::FormatRSAComponents): Added RSAComponents
      for poor man's RTTI.
      
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey):
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey):
      * crypto/keys/CryptoKeyAES.h:
      (WebCore::isCryptoKeyAES):
      (WebCore::toCryptoKeyAES):
      * crypto/keys/CryptoKeyDataOctetSequence.h:
      (WebCore::toCryptoKeyDataOctetSequence):
      * crypto/keys/CryptoKeyHMAC.h:
      (WebCore::isCryptoKeyHMAC):
      (WebCore::toCryptoKeyHMAC):
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      Switched from "as" functions to "is" and "to" ones, as that's more idiomatic.
      
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: Added.
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Added.
      Glue code for importKey/generateKey for now.
      
      * crypto/keys/CryptoKeyDataRSAComponents.cpp: Added.
      (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
      (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents):
      * crypto/keys/CryptoKeyDataRSAComponents.h: Added.
      (WebCore::toCryptoKeyDataRSAComponents):
      Added a structure to hold RSA key components, extracted from JWK or another format.
      
      * crypto/keys/CryptoKeyRSA.h: Added.
      * crypto/mac/CryptoKeyRSAMac.cpp: Added.
      
      * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
      (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
      Register RSASSA_PKCS1_v1_5.
      
      * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Added a constructor to make
      sure that hasLength is never left uninitialized, even when reading formats that
      don't contain a length.
      
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added.
      * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h: Added.
      * crypto/parameters/CryptoAlgorithmRsaSsaParams.h: Added.
      Added parameter structures that are needed for RSASSA_PKCS1_v1_5.
      
      LayoutTests:
      
      * crypto/subtle/resources/common.js:
      (hexToArrayBuffer): Fixed a typo
      (Base64URL.stringify):
      (Base64URL.parse):
      Added helpers to deal with Base64URL, as needed for JWK.
      
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Added.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a237529b
    • commit-queue@webkit.org's avatar
      Unreviewed, rolling out r159160, r159161, and r159164. · 388f415d
      commit-queue@webkit.org authored
      http://trac.webkit.org/changeset/159160
      http://trac.webkit.org/changeset/159161
      http://trac.webkit.org/changeset/159164
      https://bugs.webkit.org/show_bug.cgi?id=124253
      
      Too many errors (make fewer) (Requested by ap on #webkit).
      
      Source/WebCore:
      
      * WebCore.xcodeproj/project.pbxproj:
      * bindings/js/JSCryptoAlgorithmBuilder.cpp:
      * bindings/js/JSCryptoAlgorithmBuilder.h:
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createAesCbcParams):
      (WebCore::createAesKeyGenParams):
      (WebCore::createHmacParams):
      (WebCore::createHmacKeyParams):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForWrapKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForUnwrapKey):
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm):
      (WebCore::JSCryptoKeySerializationJWK::keyData):
      * bindings/js/JSCryptoKeySerializationJWK.h:
      * crypto/CryptoAlgorithmDescriptionBuilder.h:
      * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: Removed.
      * crypto/CryptoKey.h:
      (WebCore::ENUM_CLASS):
      * crypto/CryptoKeyData.h:
      (WebCore::CryptoKeyData::ENUM_CLASS):
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::importKey):
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
      (WebCore::CryptoAlgorithmHMAC::importKey):
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: Removed.
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Removed.
      * crypto/keys/CryptoKeyAES.h:
      (WebCore::asCryptoKeyAES):
      * crypto/keys/CryptoKeyDataOctetSequence.h:
      (WebCore::asCryptoKeyDataOctetSequence):
      * crypto/keys/CryptoKeyDataRSAComponents.cpp: Removed.
      * crypto/keys/CryptoKeyDataRSAComponents.h: Removed.
      * crypto/keys/CryptoKeyHMAC.h:
      (WebCore::asCryptoKeyHMAC):
      * crypto/keys/CryptoKeyRSA.h: Removed.
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
      (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
      * crypto/mac/CryptoKeyRSAMac.cpp: Removed.
      * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Removed.
      * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h: Removed.
      * crypto/parameters/CryptoAlgorithmRsaSsaParams.h: Removed.
      
      LayoutTests:
      
      * crypto/subtle/resources/common.js:
      (hexToArrayBuffer):
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Removed.
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Removed.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Removed.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Removed.
      * platform/mac/TestExpectations:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      388f415d
    • ap@apple.com's avatar
      Implement key generation and JWK import for RSASSA-PKCS1-v1_5 · c16dc233
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124236
      
      Source/WebCore: 
      
      Build fix.
      
      * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::buildAlgorithmDescription):
      ifdef out some code on Mountain Lion. Bug 124249 track fixing this.
      
      LayoutTests: 
      
      * platform/mac/TestExpectations: Update expectations for Mountain Lion.
      I'll investigate this later.
      
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Quickly fail is promise is rejected.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159164 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c16dc233
    • ap@apple.com's avatar
      Implement key generation and JWK import for RSASSA-PKCS1-v1_5 · c0d58adc
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124236
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html
             crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html
      
      * WebCore.xcodeproj/project.pbxproj: Added new files.
      
      * bindings/js/JSCryptoAlgorithmBuilder.cpp:
      (WebCore::JSCryptoAlgorithmBuilder::add):
      * bindings/js/JSCryptoAlgorithmBuilder.h:
      * crypto/CryptoAlgorithmDescriptionBuilder.h:
      Added a way to add an Uint8Array, as needed for RSA key.algorithm.publicExponent.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createAesCbcParams): Removed unneeded JSC prefixes.
      (WebCore::createAesKeyGenParams): Ditto.
      (WebCore::createHmacParams): Ditto.
      (WebCore::createHmacKeyParams): Ditto.
      (WebCore::createRsaKeyGenParams): Added. 
      (WebCore::createRsaSsaKeyParams): Added. WebCrypto currently doesn't specify any
      parameters for importKey, so the structure remains blank (unlike with JWK).
      (WebCore::createRsaSsaParams): Added (currently unused, will be sued for sign/verify soon).
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Added support for RSAES_PKCS1_v1_5.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Added support for RSAES_PKCS1_v1_5.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForWrapKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForUnwrapKey): Ditto.
      
      * bindings/js/JSCryptoKeySerializationJWK.h:
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::getJSArrayFromJSON): Added.
      (WebCore::getBigIntegerVectorFromJSON): Added.
      (WebCore::createRSASSAKeyParameters): Create parameters for key import. The key
      will remember which algorithm it's allowed to be used with.
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): Added support for
      RS256...RS512 (tha is, RSAES_PKCS1_v1_5 with SHA-256...SHA-512).
      (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence): Split out of keyData().
      (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): Added code to read
      RSA key components from JWK.
      (WebCore::JSCryptoKeySerializationJWK::keyData): Call one of the above functions.
      
      * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: Added.
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
      Placeholders.
      
      * crypto/CryptoKey.h: (WebCore::CryptoKeyClass): Added RSA key class for poor man's RTTI.
      
      * crypto/CryptoKeyData.h: (WebCore::CryptoKeyData::FormatRSAComponents): Added RSAComponents
      for poor man's RTTI.
      
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey): 
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey):
      * crypto/keys/CryptoKeyAES.h:
      (WebCore::isCryptoKeyAES):
      (WebCore::toCryptoKeyAES):
      * crypto/keys/CryptoKeyDataOctetSequence.h:
      (WebCore::toCryptoKeyDataOctetSequence):
      * crypto/keys/CryptoKeyHMAC.h:
      (WebCore::isCryptoKeyHMAC):
      (WebCore::toCryptoKeyHMAC):
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      Switched from "as" functions to "is" and "to" ones, as that's more idiomatic.
      
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: Added.
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Added.
      Glue code for importKey/generateKey for now.
      
      * crypto/keys/CryptoKeyDataRSAComponents.cpp: Added.
      (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
      (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents):
      * crypto/keys/CryptoKeyDataRSAComponents.h: Added.
      (WebCore::toCryptoKeyDataRSAComponents):
      Added a structure to hold RSA key components, extracted from JWK or another format.
      
      * crypto/keys/CryptoKeyRSA.h: Added.
      * crypto/mac/CryptoKeyRSAMac.cpp: Added.
      
      * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
      (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
      Register RSASSA_PKCS1_v1_5.
      
      * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Added a constructor to make
      sure that hasLength is never left uninitialized, even when reading formats that
      don't contain a length.
      
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added.
      * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h: Added.
      * crypto/parameters/CryptoAlgorithmRsaSsaParams.h: Added.
      Added parameter structures that are needed for RSASSA_PKCS1_v1_5.
      
      LayoutTests: 
      
      * crypto/subtle/resources/common.js:
      (hexToArrayBuffer): Fixed a typo
      (Base64URL.stringify):
      (Base64URL.parse):
      Added helpers to deal with Base64URL, as needed for JWK.
      
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c0d58adc