Changeset 220619 in webkit


Ignore:
Timestamp:
Aug 11, 2017 5:07:00 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[WebIDL] Replace JSCryptoKeyCustom and JSCryptoAlgorithmBuilder with generated code
https://bugs.webkit.org/show_bug.cgi?id=175457

Patch by Sam Weinig <sam@webkit.org> on 2017-08-11
Reviewed by Chris Dumez.

  • CMakeLists.txt:
  • DerivedSources.make:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSCryptoAlgorithmBuilder.cpp: Removed.
  • bindings/js/JSCryptoAlgorithmBuilder.h: Removed.
  • bindings/js/JSCryptoKeyCustom.cpp: Removed.

Remove JSCryptoAlgorithmBuilder and JSCryptoKeyCustom, add KeyAlgorithm
IDLs and headers.

  • crypto/CryptoKey.cpp:
  • crypto/CryptoKey.h:
  • crypto/CryptoKey.idl:

Replace custom algorithm attribute with a union of the supported key algorithms.

  • crypto/keys/CryptoAesKeyAlgorithm.h: Added.
  • crypto/keys/CryptoAesKeyAlgorithm.idl: Added.
  • crypto/keys/CryptoEcKeyAlgorithm.h: Added.
  • crypto/keys/CryptoEcKeyAlgorithm.idl: Added.
  • crypto/keys/CryptoHmacKeyAlgorithm.h: Added.
  • crypto/keys/CryptoHmacKeyAlgorithm.idl: Added.
  • crypto/keys/CryptoKeyAlgorithm.h: Added.
  • crypto/keys/CryptoKeyAlgorithm.idl: Added.
  • crypto/keys/CryptoRsaHashedKeyAlgorithm.h: Added.
  • crypto/keys/CryptoRsaHashedKeyAlgorithm.idl: Added.
  • crypto/keys/CryptoRsaKeyAlgorithm.h: Added.
  • crypto/keys/CryptoRsaKeyAlgorithm.idl: Added.

Add IDLs and headers fo the supported key algorithms.

  • crypto/keys/CryptoKeyAES.h:
  • crypto/keys/CryptoKeyEC.h:
  • crypto/keys/CryptoKeyHMAC.h:
  • crypto/keys/CryptoKeyRSA.h:
  • crypto/keys/CryptoKeyRaw.h:

Give each of the existing KeyAlgorithm subclasses a dictionary() function
that returns the populated corresponding spec'd dictionary.

Location:
trunk/Source/WebCore
Files:
2 deleted
17 edited
11 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r220591 r220619  
    376376    crypto/SubtleCrypto.idl
    377377    crypto/WebKitSubtleCrypto.idl
     378
     379    crypto/keys/CryptoAesKeyAlgorithm.idl
     380    crypto/keys/CryptoEcKeyAlgorithm.idl
     381    crypto/keys/CryptoHmacKeyAlgorithm.idl
     382    crypto/keys/CryptoKeyAlgorithm.idl
     383    crypto/keys/CryptoRsaHashedKeyAlgorithm.idl
     384    crypto/keys/CryptoRsaKeyAlgorithm.idl
    378385
    379386    crypto/parameters/AesCbcCfbParams.idl
     
    11821189    bindings/js/JSCallbackData.cpp
    11831190    bindings/js/JSCanvasRenderingContext2DCustom.cpp
    1184     bindings/js/JSCryptoAlgorithmBuilder.cpp
    11851191    bindings/js/JSCryptoAlgorithmDictionary.cpp
    1186     bindings/js/JSCryptoKeyCustom.cpp
    11871192    bindings/js/JSCryptoKeySerializationJWK.cpp
    11881193    bindings/js/JSCryptoOperationData.cpp
  • trunk/Source/WebCore/ChangeLog

    r220616 r220619  
     12017-08-11  Sam Weinig  <sam@webkit.org>
     2
     3        [WebIDL] Replace JSCryptoKeyCustom and JSCryptoAlgorithmBuilder with generated code
     4        https://bugs.webkit.org/show_bug.cgi?id=175457
     5
     6        Reviewed by Chris Dumez.
     7
     8        * CMakeLists.txt:
     9        * DerivedSources.make:
     10        * WebCore.xcodeproj/project.pbxproj:
     11        * bindings/js/JSCryptoAlgorithmBuilder.cpp: Removed.
     12        * bindings/js/JSCryptoAlgorithmBuilder.h: Removed.
     13        * bindings/js/JSCryptoKeyCustom.cpp: Removed.
     14
     15            Remove JSCryptoAlgorithmBuilder and JSCryptoKeyCustom, add KeyAlgorithm
     16            IDLs and headers.
     17
     18        * crypto/CryptoKey.cpp:
     19        * crypto/CryptoKey.h:
     20        * crypto/CryptoKey.idl:
     21       
     22            Replace custom algorithm attribute with a union of the supported key algorithms.
     23       
     24        * crypto/keys/CryptoAesKeyAlgorithm.h: Added.
     25        * crypto/keys/CryptoAesKeyAlgorithm.idl: Added.
     26        * crypto/keys/CryptoEcKeyAlgorithm.h: Added.
     27        * crypto/keys/CryptoEcKeyAlgorithm.idl: Added.
     28        * crypto/keys/CryptoHmacKeyAlgorithm.h: Added.
     29        * crypto/keys/CryptoHmacKeyAlgorithm.idl: Added.
     30        * crypto/keys/CryptoKeyAlgorithm.h: Added.
     31        * crypto/keys/CryptoKeyAlgorithm.idl: Added.
     32        * crypto/keys/CryptoRsaHashedKeyAlgorithm.h: Added.
     33        * crypto/keys/CryptoRsaHashedKeyAlgorithm.idl: Added.
     34        * crypto/keys/CryptoRsaKeyAlgorithm.h: Added.
     35        * crypto/keys/CryptoRsaKeyAlgorithm.idl: Added.
     36
     37            Add IDLs and headers fo the supported key algorithms.
     38
     39        * crypto/keys/CryptoKeyAES.h:
     40        * crypto/keys/CryptoKeyEC.h:
     41        * crypto/keys/CryptoKeyHMAC.h:
     42        * crypto/keys/CryptoKeyRSA.h:
     43        * crypto/keys/CryptoKeyRaw.h:
     44
     45            Give each of the existing KeyAlgorithm subclasses a dictionary() function
     46            that returns the populated corresponding spec'd dictionary.
     47
    1482017-08-11  Simon Fraser  <simon.fraser@apple.com>
    249
  • trunk/Source/WebCore/DerivedSources.make

    r220344 r220619  
    5757    $(WebCore)/bindings/js \
    5858    $(WebCore)/crypto \
     59    $(WebCore)/crypto/keys \
    5960    $(WebCore)/crypto/parameters \
    6061    $(WebCore)/css \
     
    306307    $(WebCore)/crypto/SubtleCrypto.idl \
    307308    $(WebCore)/crypto/WebKitSubtleCrypto.idl \
     309    $(WebCore)/crypto/keys/CryptoAesKeyAlgorithm.idl \
     310    $(WebCore)/crypto/keys/CryptoEcKeyAlgorithm.idl \
     311    $(WebCore)/crypto/keys/CryptoHmacKeyAlgorithm.idl \
     312    $(WebCore)/crypto/keys/CryptoKeyAlgorithm.idl \
     313    $(WebCore)/crypto/keys/CryptoRsaHashedKeyAlgorithm.idl \
     314    $(WebCore)/crypto/keys/CryptoRsaKeyAlgorithm.idl \
    308315    $(WebCore)/crypto/parameters/AesCbcCfbParams.idl \
    309316    $(WebCore)/crypto/parameters/AesCtrParams.idl \
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r220539 r220619  
    32633263                7C93F34D1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C93F34B1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp */; };
    32643264                7C93F34E1AA6BF0700A98BAB /* ContentExtensionCompiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C93F34C1AA6BF0700A98BAB /* ContentExtensionCompiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3265                7C9ACA921F3CC0AA00F3AA09 /* CryptoKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACA8F1F3CC0AA00F3AA09 /* CryptoKeyAlgorithm.h */; };
     3266                7C9ACA981F3CCDAD00F3AA09 /* CryptoAesKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACA961F3CCDAD00F3AA09 /* CryptoAesKeyAlgorithm.h */; };
     3267                7C9ACA9C1F3CCDF200F3AA09 /* CryptoEcKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACA9A1F3CCDF200F3AA09 /* CryptoEcKeyAlgorithm.h */; };
     3268                7C9ACAA01F3CCE3000F3AA09 /* CryptoHmacKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACA9E1F3CCE3000F3AA09 /* CryptoHmacKeyAlgorithm.h */; };
     3269                7C9ACAA41F3CCE6900F3AA09 /* CryptoRsaKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACAA21F3CCE6900F3AA09 /* CryptoRsaKeyAlgorithm.h */; };
     3270                7C9ACAA81F3CCEB400F3AA09 /* CryptoRsaHashedKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACAA61F3CCEB400F3AA09 /* CryptoRsaHashedKeyAlgorithm.h */; };
     3271                7C9ACAB71F3CF1AE00F3AA09 /* JSCryptoAesKeyAlgorithm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9ACAB61F3CDC4700F3AA09 /* JSCryptoAesKeyAlgorithm.cpp */; };
     3272                7C9ACAB81F3CF1AE00F3AA09 /* JSCryptoAesKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACAAA1F3CDB6300F3AA09 /* JSCryptoAesKeyAlgorithm.h */; };
     3273                7C9ACAB91F3CF1AE00F3AA09 /* JSCryptoEcKeyAlgorithm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9ACAAD1F3CDB9E00F3AA09 /* JSCryptoEcKeyAlgorithm.cpp */; };
     3274                7C9ACABA1F3CF1AE00F3AA09 /* JSCryptoEcKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACAAC1F3CDB9D00F3AA09 /* JSCryptoEcKeyAlgorithm.h */; };
     3275                7C9ACABB1F3CF1AE00F3AA09 /* JSCryptoHmacKeyAlgorithm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9ACAAE1F3CDB9F00F3AA09 /* JSCryptoHmacKeyAlgorithm.cpp */; };
     3276                7C9ACABC1F3CF1AE00F3AA09 /* JSCryptoHmacKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACAAF1F3CDB9F00F3AA09 /* JSCryptoHmacKeyAlgorithm.h */; };
     3277                7C9ACABD1F3CF1AE00F3AA09 /* JSCryptoKeyAlgorithm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9ACAB01F3CDBA000F3AA09 /* JSCryptoKeyAlgorithm.cpp */; };
     3278                7C9ACABE1F3CF1AF00F3AA09 /* JSCryptoKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACAB11F3CDBA100F3AA09 /* JSCryptoKeyAlgorithm.h */; };
     3279                7C9ACABF1F3CF1AF00F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9ACAB41F3CDC0100F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.cpp */; };
     3280                7C9ACAC01F3CF1AF00F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACAB51F3CDC0200F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.h */; };
     3281                7C9ACAC11F3CF1AF00F3AA09 /* JSCryptoRsaKeyAlgorithm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9ACAB21F3CDC0000F3AA09 /* JSCryptoRsaKeyAlgorithm.cpp */; };
     3282                7C9ACAC21F3CF1AF00F3AA09 /* JSCryptoRsaKeyAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9ACAB31F3CDC0100F3AA09 /* JSCryptoRsaKeyAlgorithm.h */; };
    32653283                7C9DBFED1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */; };
    32663284                7C9DBFEE1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */; };
     
    65296547                E157A8E418173A3A009F821D /* CryptoKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E157A8E218173A3A009F821D /* CryptoKey.cpp */; };
    65306548                E157A8E518173A3A009F821D /* CryptoKey.h in Headers */ = {isa = PBXBuildFile; fileRef = E157A8E318173A3A009F821D /* CryptoKey.h */; };
    6531                 E157A8E818184C67009F821D /* JSCryptoKeyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E157A8E618184C67009F821D /* JSCryptoKeyCustom.cpp */; };
    6532                 E157A8F018185425009F821D /* JSCryptoAlgorithmBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E157A8EE18185425009F821D /* JSCryptoAlgorithmBuilder.cpp */; };
    6533                 E157A8F118185425009F821D /* JSCryptoAlgorithmBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E157A8EF18185425009F821D /* JSCryptoAlgorithmBuilder.h */; };
    65346549                E15A36D71104572000B7B639 /* XMLNSNames.h in Headers */ = {isa = PBXBuildFile; fileRef = E15A36D61104572000B7B639 /* XMLNSNames.h */; };
    65356550                E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15A36D81104572700B7B639 /* XMLNSNames.cpp */; };
     
    1133911354                7C93F34B1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionCompiler.cpp; sourceTree = "<group>"; };
    1134011355                7C93F34C1AA6BF0700A98BAB /* ContentExtensionCompiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionCompiler.h; sourceTree = "<group>"; };
     11356                7C9ACA8F1F3CC0AA00F3AA09 /* CryptoKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoKeyAlgorithm.h; sourceTree = "<group>"; };
     11357                7C9ACA911F3CC0AA00F3AA09 /* CryptoKeyAlgorithm.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CryptoKeyAlgorithm.idl; sourceTree = "<group>"; };
     11358                7C9ACA961F3CCDAD00F3AA09 /* CryptoAesKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoAesKeyAlgorithm.h; sourceTree = "<group>"; };
     11359                7C9ACA971F3CCDAD00F3AA09 /* CryptoAesKeyAlgorithm.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CryptoAesKeyAlgorithm.idl; sourceTree = "<group>"; };
     11360                7C9ACA9A1F3CCDF200F3AA09 /* CryptoEcKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoEcKeyAlgorithm.h; sourceTree = "<group>"; };
     11361                7C9ACA9B1F3CCDF200F3AA09 /* CryptoEcKeyAlgorithm.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CryptoEcKeyAlgorithm.idl; sourceTree = "<group>"; };
     11362                7C9ACA9E1F3CCE3000F3AA09 /* CryptoHmacKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoHmacKeyAlgorithm.h; sourceTree = "<group>"; };
     11363                7C9ACA9F1F3CCE3000F3AA09 /* CryptoHmacKeyAlgorithm.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CryptoHmacKeyAlgorithm.idl; sourceTree = "<group>"; };
     11364                7C9ACAA21F3CCE6900F3AA09 /* CryptoRsaKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoRsaKeyAlgorithm.h; sourceTree = "<group>"; };
     11365                7C9ACAA31F3CCE6900F3AA09 /* CryptoRsaKeyAlgorithm.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CryptoRsaKeyAlgorithm.idl; sourceTree = "<group>"; };
     11366                7C9ACAA61F3CCEB400F3AA09 /* CryptoRsaHashedKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoRsaHashedKeyAlgorithm.h; sourceTree = "<group>"; };
     11367                7C9ACAA71F3CCEB400F3AA09 /* CryptoRsaHashedKeyAlgorithm.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CryptoRsaHashedKeyAlgorithm.idl; sourceTree = "<group>"; };
     11368                7C9ACAAA1F3CDB6300F3AA09 /* JSCryptoAesKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSCryptoAesKeyAlgorithm.h; sourceTree = "<group>"; };
     11369                7C9ACAAC1F3CDB9D00F3AA09 /* JSCryptoEcKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSCryptoEcKeyAlgorithm.h; sourceTree = "<group>"; };
     11370                7C9ACAAD1F3CDB9E00F3AA09 /* JSCryptoEcKeyAlgorithm.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoEcKeyAlgorithm.cpp; sourceTree = "<group>"; };
     11371                7C9ACAAE1F3CDB9F00F3AA09 /* JSCryptoHmacKeyAlgorithm.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoHmacKeyAlgorithm.cpp; sourceTree = "<group>"; };
     11372                7C9ACAAF1F3CDB9F00F3AA09 /* JSCryptoHmacKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSCryptoHmacKeyAlgorithm.h; sourceTree = "<group>"; };
     11373                7C9ACAB01F3CDBA000F3AA09 /* JSCryptoKeyAlgorithm.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoKeyAlgorithm.cpp; sourceTree = "<group>"; };
     11374                7C9ACAB11F3CDBA100F3AA09 /* JSCryptoKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSCryptoKeyAlgorithm.h; sourceTree = "<group>"; };
     11375                7C9ACAB21F3CDC0000F3AA09 /* JSCryptoRsaKeyAlgorithm.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoRsaKeyAlgorithm.cpp; sourceTree = "<group>"; };
     11376                7C9ACAB31F3CDC0100F3AA09 /* JSCryptoRsaKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSCryptoRsaKeyAlgorithm.h; sourceTree = "<group>"; };
     11377                7C9ACAB41F3CDC0100F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoRsaHashedKeyAlgorithm.cpp; sourceTree = "<group>"; };
     11378                7C9ACAB51F3CDC0200F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSCryptoRsaHashedKeyAlgorithm.h; sourceTree = "<group>"; };
     11379                7C9ACAB61F3CDC4700F3AA09 /* JSCryptoAesKeyAlgorithm.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoAesKeyAlgorithm.cpp; sourceTree = "<group>"; };
    1134111380                7C9DBFEA1A9C489F000D6B25 /* HTMLAttachmentElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLAttachmentElement.idl; sourceTree = "<group>"; };
    1134211381                7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAttachmentElement.cpp; sourceTree = "<group>"; };
     
    1511815157                E157A8E218173A3A009F821D /* CryptoKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoKey.cpp; sourceTree = "<group>"; };
    1511915158                E157A8E318173A3A009F821D /* CryptoKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoKey.h; sourceTree = "<group>"; };
    15120                 E157A8E618184C67009F821D /* JSCryptoKeyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoKeyCustom.cpp; sourceTree = "<group>"; };
    15121                 E157A8EE18185425009F821D /* JSCryptoAlgorithmBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoAlgorithmBuilder.cpp; sourceTree = "<group>"; };
    15122                 E157A8EF18185425009F821D /* JSCryptoAlgorithmBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCryptoAlgorithmBuilder.h; sourceTree = "<group>"; };
    1512315159                E15A36D61104572000B7B639 /* XMLNSNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLNSNames.h; sourceTree = "<group>"; };
    1512415160                E15A36D81104572700B7B639 /* XMLNSNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLNSNames.cpp; sourceTree = "<group>"; };
     
    1860418640                                5182C2511F3142500059BA7C /* JSServiceWorkerContainer.cpp */,
    1860518641                                5182C2541F3142500059BA7C /* JSServiceWorkerContainer.h */,
    18606                                 51F175001F358B3600C74950 /* JSServiceWorkerUpdateViaCache.cpp */,
    18607                                 51F175011F358B3600C74950 /* JSServiceWorkerUpdateViaCache.h */,
    1860818642                                5182C24E1F3142500059BA7C /* JSServiceWorkerGlobalScope.cpp */,
    1860918643                                5182C24D1F3142500059BA7C /* JSServiceWorkerGlobalScope.h */,
    1861018644                                5182C24F1F3142500059BA7C /* JSServiceWorkerRegistration.cpp */,
    1861118645                                5182C2501F3142500059BA7C /* JSServiceWorkerRegistration.h */,
     18646                                51F175001F358B3600C74950 /* JSServiceWorkerUpdateViaCache.cpp */,
     18647                                51F175011F358B3600C74950 /* JSServiceWorkerUpdateViaCache.h */,
    1861218648                        );
    1861318649                        name = ServiceWorkers;
     
    2354323579                                C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */,
    2354423580                                C585A66111D4FAC5004C3E4B /* IDBBindingUtilities.h */,
    23545                                 E157A8EE18185425009F821D /* JSCryptoAlgorithmBuilder.cpp */,
    23546                                 E157A8EF18185425009F821D /* JSCryptoAlgorithmBuilder.h */,
    2354723581                                E1C657101815F9DD00256CDD /* JSCryptoAlgorithmDictionary.cpp */,
    2354823582                                E1C657111815F9DD00256CDD /* JSCryptoAlgorithmDictionary.h */,
     
    2363323667                                7CD3441B1F32DE30000DCD49 /* Cached Attributes w/ Invalidation */,
    2363423668                                7C3D8EE41E08BABE0023B084 /* GC / Wrapping Only */,
    23635                                 E157A8E618184C67009F821D /* JSCryptoKeyCustom.cpp */,
    2363623669                                9BC5F9DF1D5AAF6A002B749D /* JSCustomElementRegistryCustom.cpp */,
    2363723670                                BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
     
    2457024603                        isa = PBXGroup;
    2457124604                        children = (
     24605                                7C9ACA961F3CCDAD00F3AA09 /* CryptoAesKeyAlgorithm.h */,
     24606                                7C9ACA971F3CCDAD00F3AA09 /* CryptoAesKeyAlgorithm.idl */,
     24607                                7C9ACA9A1F3CCDF200F3AA09 /* CryptoEcKeyAlgorithm.h */,
     24608                                7C9ACA9B1F3CCDF200F3AA09 /* CryptoEcKeyAlgorithm.idl */,
     24609                                7C9ACA9E1F3CCE3000F3AA09 /* CryptoHmacKeyAlgorithm.h */,
     24610                                7C9ACA9F1F3CCE3000F3AA09 /* CryptoHmacKeyAlgorithm.idl */,
    2457224611                                E125F84B1824289D00D84CD9 /* CryptoKeyAES.cpp */,
    2457324612                                E125F84C1824289D00D84CD9 /* CryptoKeyAES.h */,
     24613                                7C9ACA8F1F3CC0AA00F3AA09 /* CryptoKeyAlgorithm.h */,
     24614                                7C9ACA911F3CC0AA00F3AA09 /* CryptoKeyAlgorithm.idl */,
    2457424615                                E125F861182C303A00D84CD9 /* CryptoKeyDataOctetSequence.cpp */,
    2457524616                                E125F862182C303A00D84CD9 /* CryptoKeyDataOctetSequence.h */,
     
    2458624627                                E125F857182C1AA600D84CD9 /* CryptoKeySerializationRaw.cpp */,
    2458724628                                E125F858182C1AA600D84CD9 /* CryptoKeySerializationRaw.h */,
     24629                                7C9ACAA61F3CCEB400F3AA09 /* CryptoRsaHashedKeyAlgorithm.h */,
     24630                                7C9ACAA71F3CCEB400F3AA09 /* CryptoRsaHashedKeyAlgorithm.idl */,
     24631                                7C9ACAA21F3CCE6900F3AA09 /* CryptoRsaKeyAlgorithm.h */,
     24632                                7C9ACAA31F3CCE6900F3AA09 /* CryptoRsaKeyAlgorithm.idl */,
    2458824633                        );
    2458924634                        path = keys;
     
    2479324838                                576814421E70CB1000E77754 /* JSAesKeyParams.cpp */,
    2479424839                                576814431E70CB1000E77754 /* JSAesKeyParams.h */,
     24840                                7C9ACAB61F3CDC4700F3AA09 /* JSCryptoAesKeyAlgorithm.cpp */,
     24841                                7C9ACAAA1F3CDB6300F3AA09 /* JSCryptoAesKeyAlgorithm.h */,
    2479524842                                5739E1301DAC7FD100E14383 /* JSCryptoAlgorithmParameters.cpp */,
    2479624843                                5739E12E1DAC7F7800E14383 /* JSCryptoAlgorithmParameters.h */,
     24844                                7C9ACAAD1F3CDB9E00F3AA09 /* JSCryptoEcKeyAlgorithm.cpp */,
     24845                                7C9ACAAC1F3CDB9D00F3AA09 /* JSCryptoEcKeyAlgorithm.h */,
     24846                                7C9ACAAE1F3CDB9F00F3AA09 /* JSCryptoHmacKeyAlgorithm.cpp */,
     24847                                7C9ACAAF1F3CDB9F00F3AA09 /* JSCryptoHmacKeyAlgorithm.h */,
    2479724848                                E157A8DE1817331C009F821D /* JSCryptoKey.cpp */,
    2479824849                                E157A8DF1817331C009F821D /* JSCryptoKey.h */,
     24850                                7C9ACAB01F3CDBA000F3AA09 /* JSCryptoKeyAlgorithm.cpp */,
     24851                                7C9ACAB11F3CDBA100F3AA09 /* JSCryptoKeyAlgorithm.h */,
    2479924852                                E1F80B8B183172B5007885C3 /* JSCryptoKeyPair.cpp */,
    2480024853                                E1F80B8C183172B5007885C3 /* JSCryptoKeyPair.h */,
    2480124854                                57D0018E1DD5415300ED19D9 /* JSCryptoKeyUsage.cpp */,
    2480224855                                57D0018C1DD5413200ED19D9 /* JSCryptoKeyUsage.h */,
     24856                                7C9ACAB41F3CDC0100F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.cpp */,
     24857                                7C9ACAB51F3CDC0200F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.h */,
     24858                                7C9ACAB21F3CDC0000F3AA09 /* JSCryptoRsaKeyAlgorithm.cpp */,
     24859                                7C9ACAB31F3CDC0100F3AA09 /* JSCryptoRsaKeyAlgorithm.h */,
    2480324860                                5768143D1E709C3600E77754 /* JSEcdhKeyDeriveParams.cpp */,
    2480424861                                5768143E1E709C3600E77754 /* JSEcdhKeyDeriveParams.h */,
     
    2684826905                                E169803D1133542D00894115 /* CRuntimeObject.h in Headers */,
    2684926906                                975CA28B130365F800E99AD9 /* Crypto.h in Headers */,
     26907                                7C9ACA981F3CCDAD00F3AA09 /* CryptoAesKeyAlgorithm.h in Headers */,
    2685026908                                E172AF6E180F24C600FBADB9 /* CryptoAlgorithm.h in Headers */,
    2685126909                                E125F8421824253A00D84CD9 /* CryptoAlgorithmAES_CBC.h in Headers */,
     
    2689526953                                E19AC3F51824DC7900349426 /* CryptoAlgorithmSHA512.h in Headers */,
    2689626954                                5721A9871ECE53B10081295A /* CryptoDigestAlgorithm.h in Headers */,
     26955                                7C9ACA9C1F3CCDF200F3AA09 /* CryptoEcKeyAlgorithm.h in Headers */,
     26956                                7C9ACAA01F3CCE3000F3AA09 /* CryptoHmacKeyAlgorithm.h in Headers */,
    2689726957                                E157A8E518173A3A009F821D /* CryptoKey.h in Headers */,
    2689826958                                E125F84E1824289D00D84CD9 /* CryptoKeyAES.h in Headers */,
     26959                                7C9ACA921F3CC0AA00F3AA09 /* CryptoKeyAlgorithm.h in Headers */,
    2689926960                                E125F85E182C2DF600D84CD9 /* CryptoKeyData.h in Headers */,
    2690026961                                E125F864182C303A00D84CD9 /* CryptoKeyDataOctetSequence.h in Headers */,
     
    2690926970                                E19727161820549E00592D51 /* CryptoKeyType.h in Headers */,
    2691026971                                E172AF70180F289500FBADB9 /* CryptoKeyUsage.h in Headers */,
     26972                                7C9ACAA81F3CCEB400F3AA09 /* CryptoRsaHashedKeyAlgorithm.h in Headers */,
     26973                                7C9ACAA41F3CCE6900F3AA09 /* CryptoRsaKeyAlgorithm.h in Headers */,
    2691126974                                316FE1140E6E1DA700BF6088 /* CSSAnimationController.h in Headers */,
    2691226975                                0F15DA8A0F3AAEE70000CE47 /* CSSAnimationControllerPrivate.h in Headers */,
     
    2740127464                                316BDBF01E76292000DE0D5A /* GPUDepthStencilState.h in Headers */,
    2740227465                                316BDB861E6E0A2700DE0D5A /* GPUDevice.h in Headers */,
    27403                                 51F174FE1F35899200C74950 /* WorkerType.h in Headers */,
    2740427466                                316BDBCD1E75F18400DE0D5A /* GPUDrawable.h in Headers */,
    2740527467                                316BDBFB1E762D0400DE0D5A /* GPUEnums.h in Headers */,
     
    2749027552                                977B386A122883E900B81FF8 /* HTMLEntityParser.h in Headers */,
    2749127553                                977B386C122883E900B81FF8 /* HTMLEntitySearch.h in Headers */,
    27492                                 51F174FF1F35899700C74950 /* ServiceWorkerUpdateViaCache.h in Headers */,
    2749327554                                977B386D122883E900B81FF8 /* HTMLEntityTable.h in Headers */,
    2749427555                                A81369D4097374F600D74463 /* HTMLFieldSetElement.h in Headers */,
     
    2781927880                                77D510021ED4F71800DA4C87 /* JSCredentialUserData.h in Headers */,
    2782027881                                975CA2A21303679D00E99AD9 /* JSCrypto.h in Headers */,
    27821                                 E157A8F118185425009F821D /* JSCryptoAlgorithmBuilder.h in Headers */,
     27882                                7C9ACAB81F3CF1AE00F3AA09 /* JSCryptoAesKeyAlgorithm.h in Headers */,
    2782227883                                E1C657131815F9DD00256CDD /* JSCryptoAlgorithmDictionary.h in Headers */,
    2782327884                                5739E12F1DAC7F7800E14383 /* JSCryptoAlgorithmParameters.h in Headers */,
     27885                                7C9ACABA1F3CF1AE00F3AA09 /* JSCryptoEcKeyAlgorithm.h in Headers */,
     27886                                7C9ACABC1F3CF1AE00F3AA09 /* JSCryptoHmacKeyAlgorithm.h in Headers */,
    2782427887                                E157A8E11817331C009F821D /* JSCryptoKey.h in Headers */,
     27888                                7C9ACABE1F3CF1AF00F3AA09 /* JSCryptoKeyAlgorithm.h in Headers */,
    2782527889                                E1F80B8E183172B5007885C3 /* JSCryptoKeyPair.h in Headers */,
    2782627890                                E125F85218283A5600D84CD9 /* JSCryptoKeySerializationJWK.h in Headers */,
    2782727891                                57D0018D1DD5413200ED19D9 /* JSCryptoKeyUsage.h in Headers */,
    2782827892                                E125F83E182411E700D84CD9 /* JSCryptoOperationData.h in Headers */,
     27893                                7C9ACAC01F3CF1AF00F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.h in Headers */,
     27894                                7C9ACAC21F3CF1AF00F3AA09 /* JSCryptoRsaKeyAlgorithm.h in Headers */,
    2782927895                                BC46C1FD0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h in Headers */,
    2783027896                                BC46C1FF0C0DDC8F0020CFC3 /* JSCSSImportRule.h in Headers */,
     
    2823828304                                5182C25A1F3143CD0059BA7C /* JSServiceWorkerGlobalScope.h in Headers */,
    2823928305                                5182C25C1F3143CD0059BA7C /* JSServiceWorkerRegistration.h in Headers */,
     28306                                51F175031F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.h in Headers */,
    2824028307                                9BDA64D81B975CF2009C4387 /* JSShadowRoot.h in Headers */,
    2824128308                                46DFF49C1DC2620B00B80B48 /* JSShadowRootMode.h in Headers */,
     
    2843728504                                6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */,
    2843828505                                BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */,
    28439                                 51F175061F358BF700C74950 /* JSWorkerType.h in Headers */,
    2844028506                                6E3FAD3914733F4011E42307 /* JSWebGLDebugRendererInfo.h in Headers */,
    2844128507                                6E3FAD3914733F4022E42307 /* JSWebGLDebugShaders.h in Headers */,
     
    2849528561                                E1C362EF0EAF2AA9007410BC /* JSWorkerLocation.h in Headers */,
    2849628562                                E1271A580EEECDE400F61213 /* JSWorkerNavigator.h in Headers */,
     28563                                51F175061F358BF700C74950 /* JSWorkerType.h in Headers */,
    2849728564                                7C4C96DD1AD4483500365A60 /* JSWritableStream.h in Headers */,
    2849828565                                8358CB701C53277500E0C2D8 /* JSXMLDocument.h in Headers */,
     
    2871628783                                93309DFA099E64920056E581 /* MergeIdenticalElementsCommand.h in Headers */,
    2871728784                                E1ADECCE0E76AD8B004A1A5E /* MessageChannel.h in Headers */,
    28718                                 51F175031F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.h in Headers */,
    2871928785                                75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */,
    2872028786                                E1ADECBF0E76ACF1004A1A5E /* MessagePort.h in Headers */,
     
    2939729463                                5182C2431F313A090059BA7C /* ServiceWorkerGlobalScope.h in Headers */,
    2939829464                                5182C2451F313A090059BA7C /* ServiceWorkerRegistration.h in Headers */,
     29465                                51F174FF1F35899700C74950 /* ServiceWorkerUpdateViaCache.h in Headers */,
    2939929466                                756B2CE118B7101600FECFAA /* SessionID.h in Headers */,
    2940029467                                93309E10099E64920056E581 /* SetNodeAttributeCommand.h in Headers */,
     
    3020330270                                97AABD2D14FA09D5007457AE /* WorkerThreadableWebSocketChannel.h in Headers */,
    3020430271                                A54A0C681DB807D90017A90B /* WorkerToPageFrontendChannel.h in Headers */,
     30272                                51F174FE1F35899200C74950 /* WorkerType.h in Headers */,
    3020530273                                93309E24099E64920056E581 /* WrapContentsInDummySpanCommand.h in Headers */,
    3020630274                                416E6FE91BBD12E5000A6053 /* WritableStreamBuiltins.h in Headers */,
     
    3179831866                                77D510031ED4F71B00DA4C87 /* JSCredentialUserData.cpp in Sources */,
    3179931867                                975CA2A11303679D00E99AD9 /* JSCrypto.cpp in Sources */,
    31800                                 E157A8F018185425009F821D /* JSCryptoAlgorithmBuilder.cpp in Sources */,
     31868                                7C9ACAB71F3CF1AE00F3AA09 /* JSCryptoAesKeyAlgorithm.cpp in Sources */,
    3180131869                                E1C657121815F9DD00256CDD /* JSCryptoAlgorithmDictionary.cpp in Sources */,
    3180231870                                5739E1311DAC7FD100E14383 /* JSCryptoAlgorithmParameters.cpp in Sources */,
     31871                                7C9ACAB91F3CF1AE00F3AA09 /* JSCryptoEcKeyAlgorithm.cpp in Sources */,
     31872                                7C9ACABB1F3CF1AE00F3AA09 /* JSCryptoHmacKeyAlgorithm.cpp in Sources */,
    3180331873                                E157A8E01817331C009F821D /* JSCryptoKey.cpp in Sources */,
    31804                                 E157A8E818184C67009F821D /* JSCryptoKeyCustom.cpp in Sources */,
     31874                                7C9ACABD1F3CF1AE00F3AA09 /* JSCryptoKeyAlgorithm.cpp in Sources */,
    3180531875                                E1F80B8D183172B5007885C3 /* JSCryptoKeyPair.cpp in Sources */,
    3180631876                                E125F85118283A5600D84CD9 /* JSCryptoKeySerializationJWK.cpp in Sources */,
    3180731877                                57D0018F1DD5415300ED19D9 /* JSCryptoKeyUsage.cpp in Sources */,
    3180831878                                E125F83D182411E700D84CD9 /* JSCryptoOperationData.cpp in Sources */,
     31879                                7C9ACABF1F3CF1AF00F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.cpp in Sources */,
     31880                                7C9ACAC11F3CF1AF00F3AA09 /* JSCryptoRsaKeyAlgorithm.cpp in Sources */,
    3180931881                                BC46C1FC0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp in Sources */,
    3181031882                                BC46C1FE0C0DDC8F0020CFC3 /* JSCSSImportRule.cpp in Sources */,
     
    3207532147                                935F45420F7C3B5F00D7C1FB /* JSLazyEventListener.cpp in Sources */,
    3207632148                                BCE1C43B0D9830D3003B02F2 /* JSLocation.cpp in Sources */,
    32077                                 51F175071F358BF900C74950 /* JSWorkerType.cpp in Sources */,
    3207832149                                BCE1C4400D9830F4003B02F2 /* JSLocationCustom.cpp in Sources */,
    3207932150                                93A8061F1E03B585008A1F26 /* JSLongRange.cpp in Sources */,
     
    3223232303                                5182C2591F3143CD0059BA7C /* JSServiceWorkerGlobalScope.cpp in Sources */,
    3223332304                                5182C25B1F3143CD0059BA7C /* JSServiceWorkerRegistration.cpp in Sources */,
     32305                                51F175021F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.cpp in Sources */,
    3223432306                                9BDA64D71B975CE5009C4387 /* JSShadowRoot.cpp in Sources */,
    3223532307                                46DFF49B1DC2620B00B80B48 /* JSShadowRootMode.cpp in Sources */,
     
    3251532587                                E1C362F00EAF2AA9007410BC /* JSWorkerLocation.cpp in Sources */,
    3251632588                                E1271A590EEECDE400F61213 /* JSWorkerNavigator.cpp in Sources */,
     32589                                51F175071F358BF900C74950 /* JSWorkerType.cpp in Sources */,
    3251732590                                7C4C96DC1AD4483500365A60 /* JSWritableStream.cpp in Sources */,
    3251832591                                8358CB6F1C53277200E0C2D8 /* JSXMLDocument.cpp in Sources */,
     
    3371333786                                7AF9B20518CFB2DF00C64BEF /* VTTRegionList.cpp in Sources */,
    3371433787                                7A93868518DCC14500B8263D /* VTTScanner.cpp in Sources */,
    33715                                 51F175021F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.cpp in Sources */,
    3371633788                                A14832B1187F61E100DA63A6 /* WAKAppKitStubs.m in Sources */,
    3371733789                                A14832B3187F629100DA63A6 /* WAKClipView.m in Sources */,
  • trunk/Source/WebCore/crypto/CryptoKey.cpp

    r214362 r220619  
    3030
    3131#include "CryptoAlgorithmRegistry.h"
     32#include "CryptoKeyAES.h"
     33#include "CryptoKeyEC.h"
     34#include "CryptoKeyHMAC.h"
     35#include "CryptoKeyRSA.h"
     36#include "CryptoKeyRaw.h"
    3237#include <wtf/CryptographicallyRandomNumber.h>
    3338
     
    4449CryptoKey::~CryptoKey()
    4550{
     51}
     52
     53auto CryptoKey::algorithm() const -> AlgorithmVariant
     54{
     55    std::unique_ptr<KeyAlgorithm> algorithm = buildAlgorithm();
     56    switch (algorithm->keyAlgorithmClass()) {
     57    case KeyAlgorithmClass::AES:
     58        return downcast<AesKeyAlgorithm>(*algorithm).dictionary();
     59    case KeyAlgorithmClass::EC:
     60        return downcast<EcKeyAlgorithm>(*algorithm).dictionary();
     61    case KeyAlgorithmClass::HMAC:
     62        return downcast<HmacKeyAlgorithm>(*algorithm).dictionary();
     63    case KeyAlgorithmClass::HRSA:
     64        return downcast<RsaHashedKeyAlgorithm>(*algorithm).dictionary();
     65    case KeyAlgorithmClass::RSA:
     66        return downcast<RsaKeyAlgorithm>(*algorithm).dictionary();
     67    case KeyAlgorithmClass::Raw:
     68        return downcast<RawKeyAlgorithm>(*algorithm).dictionary();
     69    }
    4670}
    4771
  • trunk/Source/WebCore/crypto/CryptoKey.h

    r213671 r220619  
    2828#if ENABLE(SUBTLE_CRYPTO)
    2929
     30#include "CryptoAesKeyAlgorithm.h"
    3031#include "CryptoAlgorithmIdentifier.h"
     32#include "CryptoEcKeyAlgorithm.h"
     33#include "CryptoHmacKeyAlgorithm.h"
     34#include "CryptoKeyAlgorithm.h"
    3135#include "CryptoKeyType.h"
    3236#include "CryptoKeyUsage.h"
     37#include "CryptoRsaHashedKeyAlgorithm.h"
     38#include "CryptoRsaKeyAlgorithm.h"
    3339#include <wtf/Forward.h>
    3440#include <wtf/ThreadSafeRefCounted.h>
    3541#include <wtf/TypeCasts.h>
     42#include <wtf/Variant.h>
    3643#include <wtf/Vector.h>
    3744#include <wtf/text/WTFString.h>
     
    8289public:
    8390    using Type = CryptoKeyType;
     91    using AlgorithmVariant = Variant<CryptoKeyAlgorithm, CryptoAesKeyAlgorithm, CryptoEcKeyAlgorithm, CryptoHmacKeyAlgorithm, CryptoRsaHashedKeyAlgorithm, CryptoRsaKeyAlgorithm>;
     92
    8493    CryptoKey(CryptoAlgorithmIdentifier, Type, bool extractable, CryptoKeyUsageBitmap);
    8594    virtual ~CryptoKey();
    8695
    87     virtual CryptoKeyClass keyClass() const = 0;
    88 
    8996    Type type() const;
    9097    bool extractable() const { return m_extractable; }
     98    AlgorithmVariant algorithm() const;
     99    Vector<CryptoKeyUsage> usages() const;
     100
     101    virtual CryptoKeyClass keyClass() const = 0;
    91102    virtual std::unique_ptr<KeyAlgorithm> buildAlgorithm() const = 0;
    92 
    93     // Only for binding purpose.
    94     Vector<CryptoKeyUsage> usages() const;
    95103
    96104    CryptoAlgorithmIdentifier algorithmIdentifier() const { return m_algorithmIdentifier; }
  • trunk/Source/WebCore/crypto/CryptoKey.idl

    r208602 r220619  
    3030};
    3131
     32typedef (CryptoKeyAlgorithm or CryptoAesKeyAlgorithm or CryptoEcKeyAlgorithm or CryptoHmacKeyAlgorithm or CryptoRsaHashedKeyAlgorithm or CryptoRsaKeyAlgorithm) KeyAlgorithm;
     33
    3234[
    3335    Conditional=SUBTLE_CRYPTO,
     
    3840    readonly attribute KeyType type;
    3941    readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
     42    [CachedAttribute] readonly attribute KeyAlgorithm algorithm;
    4143    [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
    4244};
  • trunk/Source/WebCore/crypto/keys/CryptoAesKeyAlgorithm.h

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
     26#pragma once
     27
     28#include "CryptoKeyAlgorithm.h"
     29
     30namespace WebCore {
     31
     32struct CryptoAesKeyAlgorithm : CryptoKeyAlgorithm {
     33    // The length, in bits, of the key.
     34    unsigned short length;
    3035};
    3136
    32 [
    33     Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
    42 };
     37}
  • trunk/Source/WebCore/crypto/keys/CryptoAesKeyAlgorithm.idl

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
    30 };
    31 
    3226[
    3327    Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
     28    JSGenerateToJSObject
     29] dictionary CryptoAesKeyAlgorithm : CryptoKeyAlgorithm {
     30    // The length, in bits, of the key.
     31    required unsigned short length;
    4232};
  • trunk/Source/WebCore/crypto/keys/CryptoEcKeyAlgorithm.h

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
     26#pragma once
     27
     28#include "CryptoKeyAlgorithm.h"
     29
     30namespace WebCore {
     31
     32struct CryptoEcKeyAlgorithm : CryptoKeyAlgorithm {
     33    // The named curve that the key uses
     34    String namedCurve;
    3035};
    3136
    32 [
    33     Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
    42 };
     37}
     38
  • trunk/Source/WebCore/crypto/keys/CryptoEcKeyAlgorithm.idl

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
    30 };
     26typedef DOMString NamedCurve;
    3127
    3228[
    3329    Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
     30    JSGenerateToJSObject
     31] dictionary CryptoEcKeyAlgorithm : CryptoKeyAlgorithm {
     32    // The named curve that the key uses
     33    required NamedCurve namedCurve;
    4234};
  • trunk/Source/WebCore/crypto/keys/CryptoHmacKeyAlgorithm.h

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
     26#pragma once
     27
     28#include "CryptoKeyAlgorithm.h"
     29
     30namespace WebCore {
     31
     32struct CryptoHmacKeyAlgorithm : CryptoKeyAlgorithm {
     33    // The inner hash function to use.
     34    CryptoKeyAlgorithm hash;
     35    // The length (in bits) of the key.
     36    unsigned length;
    3037};
    3138
    32 [
    33     Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
    42 };
     39}
     40
     41
  • trunk/Source/WebCore/crypto/keys/CryptoHmacKeyAlgorithm.idl

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
    30 };
    31 
    3226[
    3327    Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
     28    JSGenerateToJSObject
     29] dictionary CryptoHmacKeyAlgorithm : CryptoKeyAlgorithm {
     30    // The inner hash function to use.
     31    required CryptoKeyAlgorithm hash;
     32    // The length (in bits) of the key.
     33    required unsigned long length;
    4234};
  • trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp

    r219831 r220619  
    3838
    3939namespace WebCore {
     40
     41CryptoAesKeyAlgorithm AesKeyAlgorithm::dictionary() const
     42{
     43    CryptoAesKeyAlgorithm result;
     44    result.name = this->name();
     45    result.length = this->length();
     46    return result;
     47}
    4048
    4149static inline bool lengthIsValid(size_t length)
  • trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h

    r213628 r220619  
    5050    KeyAlgorithmClass keyAlgorithmClass() const final { return KeyAlgorithmClass::AES; }
    5151
     52    CryptoAesKeyAlgorithm dictionary() const;
     53
    5254    size_t length() const { return m_length; }
    5355
  • trunk/Source/WebCore/crypto/keys/CryptoKeyAlgorithm.h

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626#pragma once
    2727
    28 #if ENABLE(SUBTLE_CRYPTO)
    29 
    30 #include <wtf/Forward.h>
    31 #include <wtf/Noncopyable.h>
    32 #include <wtf/Vector.h>
    3328#include <wtf/text/WTFString.h>
    34 
    35 namespace JSC {
    36 class ExecState;
    37 class JSObject;
    38 }
    3929
    4030namespace WebCore {
    4131
    42 class JSCryptoAlgorithmBuilder {
    43     WTF_MAKE_NONCOPYABLE(JSCryptoAlgorithmBuilder);
    44 public:
    45     JSCryptoAlgorithmBuilder(JSC::ExecState*);
    46     virtual ~JSCryptoAlgorithmBuilder();
    47 
    48     JSC::JSObject* result() const { return m_dictionary; }
    49 
    50     void add(const char*, unsigned);
    51     void add(const char*, const String&);
    52     void add(const char*, const Vector<uint8_t>&);
    53     void add(const char*, const JSCryptoAlgorithmBuilder&);
    54 
    55 private:
    56     JSC::ExecState* m_exec;
    57     JSC::JSObject* m_dictionary;
     32struct CryptoKeyAlgorithm {
     33    String name;
    5834};
    5935
    60 } // namespace WebCore
    61 
    62 #endif // ENABLE(SUBTLE_CRYPTO)
     36}
  • trunk/Source/WebCore/crypto/keys/CryptoKeyAlgorithm.idl

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
    30 };
    31 
    3226[
    3327    Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
     28    JSGenerateToJSObject
     29] dictionary CryptoKeyAlgorithm {
     30    required DOMString name;
    4231};
  • trunk/Source/WebCore/crypto/keys/CryptoKeyEC.cpp

    r219856 r220619  
    3636namespace WebCore {
    3737
     38CryptoEcKeyAlgorithm EcKeyAlgorithm::dictionary() const
     39{
     40    CryptoEcKeyAlgorithm result;
     41    result.name = this->name();
     42    result.namedCurve = this->namedCurve();
     43    return result;
     44}
     45
    3846static const char* const P256 = "P-256";
    3947static const char* const P384 = "P-384";
  • trunk/Source/WebCore/crypto/keys/CryptoKeyEC.h

    r216497 r220619  
    5959
    6060    const String& namedCurve() const { return m_curve; }
     61
     62    CryptoEcKeyAlgorithm dictionary() const;
    6163
    6264private:
  • trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp

    r219831 r220619  
    3838
    3939namespace WebCore {
     40
     41CryptoHmacKeyAlgorithm HmacKeyAlgorithm::dictionary() const
     42{
     43    CryptoHmacKeyAlgorithm result;
     44    result.name = this->name();
     45    result.hash.name = this->hash();
     46    result.length = this->length();
     47    return result;
     48}
    4049
    4150static size_t getKeyLengthFromHash(CryptoAlgorithmIdentifier hash)
  • trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h

    r213628 r220619  
    5353    size_t length() const { return m_length; }
    5454
     55    CryptoHmacKeyAlgorithm dictionary() const;
     56
    5557private:
    5658    String m_hash;
  • trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp

    r213560 r220619  
    2929#include "CryptoKeyDataRSAComponents.h"
    3030#include "JsonWebKey.h"
     31#include <JavaScriptCore/GenericTypedArrayViewInlines.h>
     32#include <JavaScriptCore/JSGenericTypedArrayViewInlines.h>
     33#include <heap/HeapInlines.h>
    3134#include <wtf/text/Base64.h>
    3235
     
    3437
    3538namespace WebCore {
     39
     40CryptoRsaKeyAlgorithm RsaKeyAlgorithm::dictionary() const
     41{
     42    CryptoRsaKeyAlgorithm result;
     43    result.name = this->name();
     44    result.modulusLength = this->modulusLength();
     45    result.publicExponent = Uint8Array::create(this->publicExponent().data(), this->publicExponent().size());
     46    return result;
     47}
     48
     49CryptoRsaHashedKeyAlgorithm RsaHashedKeyAlgorithm::dictionary() const
     50{
     51    CryptoRsaHashedKeyAlgorithm result;
     52    result.name = this->name();
     53    result.modulusLength = this->modulusLength();
     54    result.publicExponent = Uint8Array::create(this->publicExponent().data(), this->publicExponent().size());
     55    result.hash.name = this->hash();
     56    return result;
     57}
    3658
    3759RefPtr<CryptoKeyRSA> CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm, std::optional<CryptoAlgorithmIdentifier> hash, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages)
  • trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.h

    r216497 r220619  
    6666    const Vector<uint8_t>& publicExponent() const { return m_publicExponent; }
    6767
     68    CryptoRsaKeyAlgorithm dictionary() const;
     69
    6870private:
    6971    size_t m_modulusLength;
     
    8284
    8385    const String& hash() const { return m_hash; }
     86
     87    CryptoRsaHashedKeyAlgorithm dictionary() const;
    8488
    8589private:
  • trunk/Source/WebCore/crypto/keys/CryptoKeyRaw.cpp

    r213671 r220619  
    3434namespace WebCore {
    3535
     36CryptoKeyAlgorithm RawKeyAlgorithm::dictionary() const
     37{
     38    CryptoKeyAlgorithm result;
     39    result.name = this->name();
     40    return result;
     41}
     42
    3643CryptoKeyRaw::CryptoKeyRaw(CryptoAlgorithmIdentifier identifier, Vector<uint8_t>&& keyData, CryptoKeyUsageBitmap usages)
    3744    : CryptoKey(identifier, CryptoKeyType::Secret, false, usages)
  • trunk/Source/WebCore/crypto/keys/CryptoKeyRaw.h

    r213671 r220619  
    4040
    4141    KeyAlgorithmClass keyAlgorithmClass() const override { return KeyAlgorithmClass::Raw; }
     42   
     43    CryptoKeyAlgorithm dictionary() const;
    4244};
    4345
  • trunk/Source/WebCore/crypto/keys/CryptoRsaHashedKeyAlgorithm.h

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
     26#pragma once
     27
     28#include "CryptoRsaKeyAlgorithm.h"
     29
     30namespace WebCore {
     31
     32struct CryptoRsaHashedKeyAlgorithm : CryptoRsaKeyAlgorithm {
     33    // The hash algorithm that is used with this key
     34    CryptoKeyAlgorithm hash;
    3035};
    3136
    32 [
    33     Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
    42 };
     37}
     38
  • trunk/Source/WebCore/crypto/keys/CryptoRsaHashedKeyAlgorithm.idl

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
    30 };
    31 
    3226[
    3327    Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
     28    JSGenerateToJSObject
     29] dictionary CryptoRsaHashedKeyAlgorithm : CryptoRsaKeyAlgorithm {
     30    // The hash algorithm that is used with this key
     31    required CryptoKeyAlgorithm hash;
    4232};
  • trunk/Source/WebCore/crypto/keys/CryptoRsaKeyAlgorithm.h

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
     26#pragma once
     27
     28#include "CryptoKeyAlgorithm.h"
     29#include <runtime/Uint8Array.h>
     30
     31namespace WebCore {
     32
     33struct CryptoRsaKeyAlgorithm : CryptoKeyAlgorithm {
     34    // The length, in bits, of the RSA modulus
     35    unsigned modulusLength;
     36    // The RSA public exponent
     37    RefPtr<Uint8Array> publicExponent;
    3038};
    3139
    32 [
    33     Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
    42 };
     40}
     41
  • trunk/Source/WebCore/crypto/keys/CryptoRsaKeyAlgorithm.idl

    r220618 r220619  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum KeyType {
    27     "public",
    28     "private",
    29     "secret"
    30 };
     26typedef Uint8Array BigInteger;
    3127
    3228[
    3329    Conditional=SUBTLE_CRYPTO,
    34     Exposed=(Window,Worker),
    35     GenerateIsReachable=Impl,
    36     SkipVTableValidation
    37 ] interface CryptoKey {
    38     readonly attribute KeyType type;
    39     readonly attribute boolean extractable;
    40     [CachedAttribute, CustomGetter] readonly attribute object algorithm;
    41     [CachedAttribute] readonly attribute sequence<CryptoKeyUsage> usages;
     30    JSGenerateToJSObject
     31] dictionary CryptoRsaKeyAlgorithm : CryptoKeyAlgorithm {
     32    // The length, in bits, of the RSA modulus
     33    required unsigned long modulusLength;
     34    // The RSA public exponent
     35    required BigInteger publicExponent;
    4236};
Note: See TracChangeset for help on using the changeset viewer.