mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
feat(ext/crypto): implement AES-KW for wrapKey/unwrapKey (#13286)
This commit is contained in:
parent
605b8db8f6
commit
91f6c5fc7e
7 changed files with 363 additions and 237 deletions
334
Cargo.lock
generated
334
Cargo.lock
generated
|
@ -59,6 +59,16 @@ dependencies = [
|
|||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aes-kw"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da2cfe3156f99bc2978b812bcc9c98c6850810e2c0cd48366abb7163a1beeed0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.6"
|
||||
|
@ -150,8 +160,8 @@ checksum = "82b2dd56b7c509b3a0bb47a97a066cba459983470d3b8a3c20428737270f70bd"
|
|||
dependencies = [
|
||||
"darling",
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
@ -186,8 +196,8 @@ version = "0.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -197,8 +207,8 @@ version = "0.1.52"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -220,8 +230,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "7862e21c893d65a1650125d157eaeec691439379a1cee17ee49031b79236ada4"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -430,9 +440,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "4.2.2"
|
||||
version = "4.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3db8340083d28acb43451166543b98c838299b7e0863621be53a338adceea0ed"
|
||||
checksum = "1951fb8aa063a2ee18b4b4d217e4aa2ec9cc4f2430482983f607fa10cd36d7aa"
|
||||
dependencies = [
|
||||
"error-code",
|
||||
"str-buf",
|
||||
|
@ -579,7 +589,7 @@ version = "0.1.20"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d"
|
||||
dependencies = [
|
||||
"quote 1.0.10",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -627,8 +637,8 @@ checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b"
|
|||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"strsim 0.9.3",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
@ -640,7 +650,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote 1.0.10",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -819,6 +829,7 @@ version = "0.45.0"
|
|||
dependencies = [
|
||||
"aes",
|
||||
"aes-gcm",
|
||||
"aes-kw",
|
||||
"base64 0.13.0",
|
||||
"block-modes",
|
||||
"ctr",
|
||||
|
@ -1023,8 +1034,8 @@ dependencies = [
|
|||
"rustls-native-certs",
|
||||
"rustls-pemfile",
|
||||
"serde",
|
||||
"webpki 0.22.0",
|
||||
"webpki-roots 0.22.1",
|
||||
"webpki",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1111,8 +1122,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"rustc_version 0.4.0",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
@ -1289,8 +1300,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -1301,7 +1312,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "78b940da354ae81ef0926c5eaa428207b8f4f091d3956c891dfbd124162bed99"
|
||||
dependencies = [
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"proc-macro2 1.0.36",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
@ -1403,9 +1414,9 @@ checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
|||
|
||||
[[package]]
|
||||
name = "fixedbitset"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "398ea4fabe40b9b0d885340a2a991a44c8a645624075ad966d21f88688e2b69e"
|
||||
checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e"
|
||||
|
||||
[[package]]
|
||||
name = "flaky_test"
|
||||
|
@ -1413,8 +1424,8 @@ version = "0.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "479cde5eb168cf5a056dd98f311cbfab7494c216394e4fb9eba0336827a8db93"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -1468,7 +1479,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "0951635027ca477be98f8774abd6f0345233439d63f307e47101acb40c7cc63d"
|
||||
dependencies = [
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"proc-macro2 1.0.36",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
@ -1505,9 +1516,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cd0210d8c325c245ff06fd95a3b13689a1a276ac8cfa8e8720cb840bfb84b9e"
|
||||
checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -1520,9 +1531,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27"
|
||||
checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
|
@ -1530,15 +1541,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445"
|
||||
checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b808bf53348a36cab739d7e04755909b9fcaaa69b7d7e588b37b6ec62704c97"
|
||||
checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
|
@ -1547,38 +1558,38 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11"
|
||||
checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd"
|
||||
checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af"
|
||||
checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12"
|
||||
checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e"
|
||||
checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -1613,9 +1624,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.4"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
|
||||
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
|
@ -1655,9 +1666,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "glow"
|
||||
version = "0.11.0"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f04649123493bc2483cbef4daddb45d40bbdae5adb221a63a23efdb0cc99520"
|
||||
checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"slotmap",
|
||||
|
@ -1799,7 +1810,7 @@ checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11"
|
|||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa",
|
||||
"itoa 0.4.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1846,7 +1857,7 @@ dependencies = [
|
|||
"http-body",
|
||||
"httparse",
|
||||
"httpdate",
|
||||
"itoa",
|
||||
"itoa 0.4.8",
|
||||
"pin-project-lite",
|
||||
"socket2 0.4.2",
|
||||
"tokio",
|
||||
|
@ -1979,8 +1990,8 @@ checksum = "a322dd16d960e322c3d92f541b4c1a4f0a2e81e1fdeee430d8cecc8b72e8015f"
|
|||
dependencies = [
|
||||
"Inflector",
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -1990,6 +2001,12 @@ version = "0.4.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.24"
|
||||
|
@ -2221,8 +2238,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ca1d48da0e4a6100b4afd52fae99f36d47964a209624021280ad9ffdd410e83d"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -2628,7 +2645,7 @@ version = "0.6.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f"
|
||||
dependencies = [
|
||||
"fixedbitset 0.4.0",
|
||||
"fixedbitset 0.4.1",
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
|
@ -2662,8 +2679,8 @@ dependencies = [
|
|||
"phf_generator",
|
||||
"phf_shared",
|
||||
"proc-macro-hack",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -2691,16 +2708,16 @@ version = "1.0.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
|
||||
checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
|
@ -2733,9 +2750,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1a3ea4f0dd7f1f3e512cf97bf100819aa547f36a6eccac8dbaae839eb92363e"
|
||||
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
|
||||
|
||||
[[package]]
|
||||
name = "pmutil"
|
||||
|
@ -2743,8 +2760,8 @@ version = "0.5.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -2762,9 +2779,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
|
||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
||||
|
||||
[[package]]
|
||||
name = "precomputed-hash"
|
||||
|
@ -2791,8 +2808,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
"version_check",
|
||||
]
|
||||
|
@ -2803,8 +2820,8 @@ version = "1.0.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
|
@ -2825,18 +2842,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.33"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a"
|
||||
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "profiling"
|
||||
version = "1.0.4"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9926767b8b8244d7b6b64546585121d193c3d0b4856ccd656b7bfa9deb91ab6a"
|
||||
checksum = "9145ac0af1d93c638c98c40cf7d25665f427b2a44ad0a99b1dccf3e2f25bb987"
|
||||
|
||||
[[package]]
|
||||
name = "pty"
|
||||
|
@ -2876,11 +2893,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.10"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
|
||||
checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"proc-macro2 1.0.36",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3070,9 +3087,9 @@ checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
|
|||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.11.7"
|
||||
version = "0.11.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07bea77bc708afa10e59905c3d4af7c8fd43c9214251673095ff8b14345fcbc5"
|
||||
checksum = "7c4e0a76dc12a116108933f6301b95e83634e0c47b0afbed6abbaa0601e99258"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"base64 0.13.0",
|
||||
|
@ -3103,7 +3120,7 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"webpki-roots 0.21.1",
|
||||
"webpki-roots",
|
||||
"winreg 0.7.0",
|
||||
]
|
||||
|
||||
|
@ -3217,7 +3234,7 @@ dependencies = [
|
|||
"log",
|
||||
"ring",
|
||||
"sct",
|
||||
"webpki 0.22.0",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3270,15 +3287,15 @@ version = "0.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "688599bdab9f42105d0ae1494335a9ffafdeb7d36325e6b10fd4abc5829d6284"
|
||||
dependencies = [
|
||||
"quote 1.0.10",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.6"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568"
|
||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
|
@ -3398,19 +3415,19 @@ version = "1.0.133"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.72"
|
||||
version = "1.0.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527"
|
||||
checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"itoa",
|
||||
"itoa 1.0.1",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
@ -3421,8 +3438,8 @@ version = "0.1.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -3433,7 +3450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"itoa",
|
||||
"itoa 0.4.8",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
@ -3629,8 +3646,8 @@ checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97"
|
|||
dependencies = [
|
||||
"phf_generator",
|
||||
"phf_shared",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3640,8 +3657,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "f584cc881e9e5f1fd6bf827b0444aa94c30d8fe6378cf241071b5f5700b2871f"
|
||||
dependencies = [
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
@ -3774,8 +3791,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "bdbf826c739281cdb3b3c23883fd1a7586ea1c15b1287530e7123a7fad8f0e25"
|
||||
dependencies = [
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
@ -3827,9 +3844,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms"
|
||||
version = "0.106.0"
|
||||
version = "0.106.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7f2517337858bcbb43be51ff34033f80ca0379e0838e6cbdcdb62e88d56b9ec"
|
||||
checksum = "f4069c5474cfb5f786fa20dd013ab8b8b73f35522f82372e71c2307a2b904e38"
|
||||
dependencies = [
|
||||
"swc_atoms",
|
||||
"swc_common",
|
||||
|
@ -3846,9 +3863,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_base"
|
||||
version = "0.52.0"
|
||||
version = "0.52.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06384503de52f097bbaa41fbe488510041906a69b3f01449ef024384eeb7fabf"
|
||||
checksum = "ec358dadefdc2a834a623192bc972df7a74443a80b73a538495ebbf652bfc97d"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"phf",
|
||||
|
@ -3884,8 +3901,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "18712e4aab969c6508dff3540ade6358f1e013464aa58b3d30da2ab2d9fcbbed"
|
||||
dependencies = [
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
@ -3990,9 +4007,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecma_visit"
|
||||
version = "0.48.0"
|
||||
version = "0.48.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3185cd9fa4460935d9a9f1efc5eed1efc5b57a58d471313b88bee1ecfdeff268"
|
||||
checksum = "decbd767e2630eb650cd97d49c74e4ce32beb9daeccd9602f52c48f32436006c"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"swc_atoms",
|
||||
|
@ -4004,9 +4021,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "swc_ecmascript"
|
||||
version = "0.103.0"
|
||||
version = "0.103.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff3180fe209baa9f0fa4a693b2c569f40b010ee3e8155c72435b3b79fc0686e3"
|
||||
checksum = "c47c72500ac5300ab11d5ede08c9bab878ac065c8a9169d34f2f7f28b1ec19f2"
|
||||
dependencies = [
|
||||
"swc_ecma_ast",
|
||||
"swc_ecma_codegen",
|
||||
|
@ -4024,8 +4041,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "8c8f200a2eaed938e7c1a685faaa66e6d42fa9e17da5f62572d3cbc335898f5e"
|
||||
dependencies = [
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -4061,8 +4078,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "08ed2e930f5a1a4071fe62c90fd3a296f6030e5d94bfe13993244423caf59a78"
|
||||
dependencies = [
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -4084,8 +4101,8 @@ checksum = "e505bbf8e11898fa05a65aa5e773c827ec743fc15aa3c064c9e06164ed0b6630"
|
|||
dependencies = [
|
||||
"Inflector",
|
||||
"pmutil",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
@ -4107,8 +4124,8 @@ version = "1.0.65"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"unicode-xid 0.2.2",
|
||||
]
|
||||
|
||||
|
@ -4118,8 +4135,8 @@ version = "0.12.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
"unicode-xid 0.2.2",
|
||||
]
|
||||
|
@ -4227,8 +4244,8 @@ version = "1.0.30"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -4280,24 +4297,24 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "1.6.0"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e"
|
||||
checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.23.1"
|
||||
version = "0.23.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4baa378e417d780beff82bf54ceb0d195193ea6a00c14e22359e7f39456b5689"
|
||||
checksum = "a27d5f2b839802bd8267fa19b0530f5a08b9c08cd417976be2a65d130fe1c11b"
|
||||
dependencies = [
|
||||
"rustls",
|
||||
"tokio",
|
||||
"webpki 0.22.0",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4323,8 +4340,8 @@ dependencies = [
|
|||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tungstenite",
|
||||
"webpki 0.22.0",
|
||||
"webpki-roots 0.22.1",
|
||||
"webpki",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4374,8 +4391,8 @@ version = "0.1.18"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
]
|
||||
|
||||
|
@ -4502,7 +4519,7 @@ dependencies = [
|
|||
"thiserror",
|
||||
"url",
|
||||
"utf-8",
|
||||
"webpki 0.22.0",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4523,9 +4540,9 @@ checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae"
|
|||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.14.0"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"
|
||||
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
|
||||
|
||||
[[package]]
|
||||
name = "ucd-trie"
|
||||
|
@ -4728,9 +4745,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
|||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.3"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
|
@ -4790,8 +4807,8 @@ dependencies = [
|
|||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -4814,7 +4831,7 @@ version = "0.2.72"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b"
|
||||
dependencies = [
|
||||
"quote 1.0.10",
|
||||
"quote 1.0.14",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
|
@ -4824,8 +4841,8 @@ version = "0.2.72"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
|
@ -4847,16 +4864,6 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki"
|
||||
version = "0.21.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki"
|
||||
version = "0.22.0"
|
||||
|
@ -4869,20 +4876,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.21.1"
|
||||
version = "0.22.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940"
|
||||
checksum = "552ceb903e957524388c4d3475725ff2c8b7960922063af6ce53c9a43da07449"
|
||||
dependencies = [
|
||||
"webpki 0.21.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c475786c6f47219345717a043a37ec04cb4bc185e28853adcc4fa0a947eba630"
|
||||
dependencies = [
|
||||
"webpki 0.22.0",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -5097,8 +5095,8 @@ version = "1.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65f1a51723ec88c66d5d1fe80c841f17f63587d6691901d66be9bec6c3b51f73"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.33",
|
||||
"quote 1.0.10",
|
||||
"proc-macro2 1.0.36",
|
||||
"quote 1.0.14",
|
||||
"syn 1.0.65",
|
||||
"synstructure",
|
||||
]
|
||||
|
|
|
@ -1561,3 +1561,61 @@ Deno.test(async function testSecretJwkBase64Url() {
|
|||
},
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test(async function testAESWrapKey() {
|
||||
const key = await crypto.subtle.generateKey(
|
||||
{
|
||||
name: "AES-KW",
|
||||
length: 128,
|
||||
},
|
||||
true,
|
||||
["wrapKey", "unwrapKey"],
|
||||
);
|
||||
|
||||
const hmacKey = await crypto.subtle.generateKey(
|
||||
{
|
||||
name: "HMAC",
|
||||
hash: "SHA-256",
|
||||
length: 128,
|
||||
},
|
||||
true,
|
||||
["sign"],
|
||||
);
|
||||
|
||||
//round-trip
|
||||
// wrap-unwrap-export compare
|
||||
const wrappedKey = await crypto.subtle.wrapKey(
|
||||
"raw",
|
||||
hmacKey,
|
||||
key,
|
||||
{
|
||||
name: "AES-KW",
|
||||
},
|
||||
);
|
||||
|
||||
assert(wrappedKey instanceof ArrayBuffer);
|
||||
assertEquals(wrappedKey.byteLength, 16 + 8); // 8 = 'auth tag'
|
||||
|
||||
const unwrappedKey = await crypto.subtle.unwrapKey(
|
||||
"raw",
|
||||
wrappedKey,
|
||||
key,
|
||||
{
|
||||
name: "AES-KW",
|
||||
},
|
||||
{
|
||||
name: "HMAC",
|
||||
hash: "SHA-256",
|
||||
},
|
||||
true,
|
||||
["sign"],
|
||||
);
|
||||
|
||||
assert(unwrappedKey instanceof CryptoKey);
|
||||
assertEquals((unwrappedKey.algorithm as HmacKeyAlgorithm).length, 128);
|
||||
|
||||
const hmacKeyBytes = await crypto.subtle.exportKey("raw", hmacKey);
|
||||
const unwrappedKeyBytes = await crypto.subtle.exportKey("raw", unwrappedKey);
|
||||
|
||||
assertEquals(new Uint8Array(hmacKeyBytes), new Uint8Array(unwrappedKeyBytes));
|
||||
});
|
||||
|
|
|
@ -145,12 +145,10 @@
|
|||
"PBKDF2": null,
|
||||
},
|
||||
"wrapKey": {
|
||||
// TODO(@littledivy): Enable this once implemented.
|
||||
// "AES-KW": "AesKeyWrapParams",
|
||||
"AES-KW": null,
|
||||
},
|
||||
"unwrapKey": {
|
||||
// TODO(@littledivy): Enable this once implemented.
|
||||
// "AES-KW": "AesKeyWrapParams",
|
||||
"AES-KW": null,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -1271,14 +1269,30 @@
|
|||
if (
|
||||
supportedAlgorithms["wrapKey"][normalizedAlgorithm.name] !== undefined
|
||||
) {
|
||||
// TODO(@littledivy): Implement this for AES-KW.
|
||||
throw new DOMException(
|
||||
"Not implemented",
|
||||
"NotSupportedError",
|
||||
);
|
||||
const handle = wrappingKey[_handle];
|
||||
const keyData = WeakMapPrototypeGet(KEY_STORE, handle);
|
||||
|
||||
switch (normalizedAlgorithm.name) {
|
||||
case "AES-KW": {
|
||||
const cipherText = await core.opSync("op_crypto_wrap_key", {
|
||||
key: keyData,
|
||||
algorithm: normalizedAlgorithm.name,
|
||||
}, bytes);
|
||||
|
||||
// 4.
|
||||
return cipherText.buffer;
|
||||
}
|
||||
default: {
|
||||
throw new DOMException(
|
||||
"Not implemented",
|
||||
"NotSupportedError",
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
supportedAlgorithms["encrypt"][normalizedAlgorithm.name] !== undefined
|
||||
) {
|
||||
// must construct a new key, since keyUsages is ["wrapKey"] and not ["encrypt"]
|
||||
return await encrypt(
|
||||
normalizedAlgorithm,
|
||||
constructKey(
|
||||
|
@ -1391,14 +1405,31 @@
|
|||
if (
|
||||
supportedAlgorithms["unwrapKey"][normalizedAlgorithm.name] !== undefined
|
||||
) {
|
||||
// TODO(@littledivy): Implement this for AES-KW.
|
||||
throw new DOMException(
|
||||
"Not implemented",
|
||||
"NotSupportedError",
|
||||
);
|
||||
const handle = unwrappingKey[_handle];
|
||||
const keyData = WeakMapPrototypeGet(KEY_STORE, handle);
|
||||
|
||||
switch (normalizedAlgorithm.name) {
|
||||
case "AES-KW": {
|
||||
const plainText = await core.opSync("op_crypto_unwrap_key", {
|
||||
key: keyData,
|
||||
algorithm: normalizedAlgorithm.name,
|
||||
}, wrappedKey);
|
||||
|
||||
// 4.
|
||||
key = plainText.buffer;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new DOMException(
|
||||
"Not implemented",
|
||||
"NotSupportedError",
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
supportedAlgorithms["decrypt"][normalizedAlgorithm.name] !== undefined
|
||||
) {
|
||||
// must construct a new key, since keyUsages is ["unwrapKey"] and not ["decrypt"]
|
||||
key = await this.decrypt(
|
||||
normalizedAlgorithm,
|
||||
constructKey(
|
||||
|
|
|
@ -16,6 +16,7 @@ path = "lib.rs"
|
|||
[dependencies]
|
||||
aes = "0.7.5"
|
||||
aes-gcm = "0.9.4"
|
||||
aes-kw = { version = "0.1", features = ["alloc"] }
|
||||
base64 = "0.13.0"
|
||||
block-modes = "0.8.1"
|
||||
ctr = "0.8.0"
|
||||
|
|
13
ext/crypto/lib.deno_crypto.d.ts
vendored
13
ext/crypto/lib.deno_crypto.d.ts
vendored
|
@ -293,7 +293,11 @@ interface SubtleCrypto {
|
|||
format: KeyFormat,
|
||||
key: CryptoKey,
|
||||
wrappingKey: CryptoKey,
|
||||
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams,
|
||||
wrapAlgorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaOaepParams
|
||||
| AesCbcParams
|
||||
| AesCtrParams,
|
||||
): Promise<ArrayBuffer>;
|
||||
unwrapKey(
|
||||
format: KeyFormat,
|
||||
|
@ -302,12 +306,13 @@ interface SubtleCrypto {
|
|||
unwrapAlgorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaOaepParams
|
||||
| AesCbcParams,
|
||||
| AesCbcParams
|
||||
| AesCtrParams,
|
||||
unwrappedKeyAlgorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaHashedImportParams
|
||||
| HmacImportParams
|
||||
| AesKeyAlgorithm,
|
||||
| RsaHashedImportParams
|
||||
| EcImportParams,
|
||||
extractable: boolean,
|
||||
keyUsages: KeyUsage[],
|
||||
): Promise<CryptoKey>;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use aes_kw::KekAes128;
|
||||
use aes_kw::KekAes192;
|
||||
use aes_kw::KekAes256;
|
||||
|
||||
use deno_core::error::custom_error;
|
||||
use deno_core::error::not_supported;
|
||||
use deno_core::error::type_error;
|
||||
|
@ -11,6 +15,7 @@ use deno_core::Extension;
|
|||
use deno_core::OpState;
|
||||
use deno_core::ZeroCopyBuf;
|
||||
use serde::Deserialize;
|
||||
use shared::operation_error;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::num::NonZeroU32;
|
||||
|
@ -47,6 +52,7 @@ use sha2::Digest;
|
|||
use sha2::Sha256;
|
||||
use sha2::Sha384;
|
||||
use sha2::Sha512;
|
||||
use std::convert::TryFrom;
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub use rand; // Re-export rand
|
||||
|
@ -68,6 +74,7 @@ use crate::key::Algorithm;
|
|||
use crate::key::CryptoHash;
|
||||
use crate::key::CryptoNamedCurve;
|
||||
use crate::key::HkdfOutput;
|
||||
use crate::shared::RawKeyData;
|
||||
use crate::shared::ID_MFG1;
|
||||
use crate::shared::ID_P_SPECIFIED;
|
||||
use crate::shared::ID_SHA1_OID;
|
||||
|
@ -95,6 +102,8 @@ pub fn init(maybe_seed: Option<u64>) -> Extension {
|
|||
("op_crypto_decrypt", op_async(op_crypto_decrypt)),
|
||||
("op_crypto_subtle_digest", op_async(op_crypto_subtle_digest)),
|
||||
("op_crypto_random_uuid", op_sync(op_crypto_random_uuid)),
|
||||
("op_crypto_wrap_key", op_sync(op_crypto_wrap_key)),
|
||||
("op_crypto_unwrap_key", op_sync(op_crypto_unwrap_key)),
|
||||
])
|
||||
.state(move |state| {
|
||||
if let Some(seed) = maybe_seed {
|
||||
|
@ -815,6 +824,72 @@ pub async fn op_crypto_subtle_digest(
|
|||
Ok(output)
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WrapUnwrapKeyArg {
|
||||
key: RawKeyData,
|
||||
algorithm: Algorithm,
|
||||
}
|
||||
|
||||
pub fn op_crypto_wrap_key(
|
||||
_state: &mut OpState,
|
||||
args: WrapUnwrapKeyArg,
|
||||
data: ZeroCopyBuf,
|
||||
) -> Result<ZeroCopyBuf, AnyError> {
|
||||
let algorithm = args.algorithm;
|
||||
|
||||
match algorithm {
|
||||
Algorithm::AesKw => {
|
||||
let key = args.key.as_secret_key()?;
|
||||
|
||||
if data.len() % 8 != 0 {
|
||||
return Err(type_error("Data must be multiple of 8 bytes"));
|
||||
}
|
||||
|
||||
let wrapped_key = match key.len() {
|
||||
16 => KekAes128::new(key.into()).wrap_vec(&data),
|
||||
24 => KekAes192::new(key.into()).wrap_vec(&data),
|
||||
32 => KekAes256::new(key.into()).wrap_vec(&data),
|
||||
_ => return Err(type_error("Invalid key length")),
|
||||
}
|
||||
.map_err(|_| operation_error("encryption error"))?;
|
||||
|
||||
Ok(wrapped_key.into())
|
||||
}
|
||||
_ => Err(type_error("Unsupported algorithm")),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn op_crypto_unwrap_key(
|
||||
_state: &mut OpState,
|
||||
args: WrapUnwrapKeyArg,
|
||||
data: ZeroCopyBuf,
|
||||
) -> Result<ZeroCopyBuf, AnyError> {
|
||||
let algorithm = args.algorithm;
|
||||
match algorithm {
|
||||
Algorithm::AesKw => {
|
||||
let key = args.key.as_secret_key()?;
|
||||
|
||||
if data.len() % 8 != 0 {
|
||||
return Err(type_error("Data must be multiple of 8 bytes"));
|
||||
}
|
||||
|
||||
let unwrapped_key = match key.len() {
|
||||
16 => KekAes128::new(key.into()).unwrap_vec(&data),
|
||||
24 => KekAes192::new(key.into()).unwrap_vec(&data),
|
||||
32 => KekAes256::new(key.into()).unwrap_vec(&data),
|
||||
_ => return Err(type_error("Invalid key length")),
|
||||
}
|
||||
.map_err(|_| {
|
||||
operation_error("decryption error - integrity check failed")
|
||||
})?;
|
||||
|
||||
Ok(unwrapped_key.into())
|
||||
}
|
||||
_ => Err(type_error("Unsupported algorithm")),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_declaration() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_crypto.d.ts")
|
||||
}
|
||||
|
|
|
@ -1124,15 +1124,9 @@
|
|||
"Can wrap and unwrap AES-GCM keys as non-extractable using raw and AES-CTR",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using jwk and AES-CTR",
|
||||
"Can unwrap AES-GCM non-extractable keys using jwk and AES-CTR",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using raw and AES-CTR",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using jwk and AES-CTR",
|
||||
"Can unwrap AES-KW non-extractable keys using jwk and AES-CTR",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using raw and AES-CBC",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using jwk and AES-CBC",
|
||||
"Can unwrap AES-GCM non-extractable keys using jwk and AES-CBC",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using raw and AES-CBC",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using jwk and AES-CBC",
|
||||
"Can unwrap AES-KW non-extractable keys using jwk and AES-CBC",
|
||||
"Can wrap and unwrap HMAC keys using raw and AES-GCM",
|
||||
"Can wrap and unwrap HMAC keys as non-extractable using raw and AES-GCM",
|
||||
"Can wrap and unwrap HMAC keys using jwk and AES-GCM",
|
||||
|
@ -1158,13 +1152,6 @@
|
|||
"Can wrap and unwrap AES-KW keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using jwk and AES-GCM",
|
||||
"Can unwrap AES-KW non-extractable keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS public key keys using spki and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS public key keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS private key keys using pkcs8 and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS private key keys as non-extractable using pkcs8 and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS private key keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS private key keys as non-extractable using jwk and AES-GCM",
|
||||
"Can unwrap RSA-PSS private key non-extractable keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-OAEP public key keys using spki and AES-GCM",
|
||||
"Can wrap and unwrap RSA-OAEP public key keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-OAEP private key keys using pkcs8 and AES-GCM",
|
||||
|
@ -1172,6 +1159,13 @@
|
|||
"Can wrap and unwrap RSA-OAEP private key keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-OAEP private key keys as non-extractable using jwk and AES-GCM",
|
||||
"Can unwrap RSA-OAEP private key non-extractable keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS public key keys using spki and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS public key keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS private key keys using pkcs8 and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS private key keys as non-extractable using pkcs8 and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS private key keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS private key keys as non-extractable using jwk and AES-GCM",
|
||||
"Can unwrap RSA-PSS private key non-extractable keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSASSA-PKCS1-v1_5 public key keys using spki and AES-GCM",
|
||||
"Can wrap and unwrap RSASSA-PKCS1-v1_5 public key keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSASSA-PKCS1-v1_5 private key keys using pkcs8 and AES-GCM",
|
||||
|
@ -1179,40 +1173,19 @@
|
|||
"Can wrap and unwrap RSASSA-PKCS1-v1_5 private key keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSASSA-PKCS1-v1_5 private key keys as non-extractable using jwk and AES-GCM",
|
||||
"Can unwrap RSASSA-PKCS1-v1_5 private key non-extractable keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap HMAC keys using raw and AES-KW",
|
||||
"Can wrap and unwrap HMAC keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-CTR keys using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-CTR keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-CBC keys using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-CBC keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-GCM keys using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-KW keys using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap RSA-PSS public key keys using jwk and AES-KW",
|
||||
"Can wrap and unwrap RSA-OAEP public key keys using jwk and AES-KW",
|
||||
"Can wrap and unwrap RSASSA-PKCS1-v1_5 public key keys using jwk and AES-KW",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using raw and RSA-OAEP",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using jwk and RSA-OAEP",
|
||||
"Can unwrap AES-GCM non-extractable keys using jwk and RSA-OAEP",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using raw and RSA-OAEP",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using jwk and RSA-OAEP",
|
||||
"Can unwrap AES-KW non-extractable keys using jwk and RSA-OAEP"
|
||||
"Can unwrap AES-GCM non-extractable keys using jwk and RSA-OAEP"
|
||||
],
|
||||
"wrapKey_unwrapKey.https.any.worker.html": [
|
||||
"setup",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using raw and AES-CTR",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using jwk and AES-CTR",
|
||||
"Can unwrap AES-GCM non-extractable keys using jwk and AES-CTR",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using raw and AES-CTR",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using jwk and AES-CTR",
|
||||
"Can unwrap AES-KW non-extractable keys using jwk and AES-CTR",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using raw and AES-CBC",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using jwk and AES-CBC",
|
||||
"Can unwrap AES-GCM non-extractable keys using jwk and AES-CBC",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using raw and AES-CBC",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using jwk and AES-CBC",
|
||||
"Can unwrap AES-KW non-extractable keys using jwk and AES-CBC",
|
||||
"Can wrap and unwrap HMAC keys using raw and AES-GCM",
|
||||
"Can wrap and unwrap HMAC keys as non-extractable using raw and AES-GCM",
|
||||
"Can wrap and unwrap HMAC keys using jwk and AES-GCM",
|
||||
|
@ -1259,25 +1232,10 @@
|
|||
"Can wrap and unwrap RSA-PSS private key keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap RSA-PSS private key keys as non-extractable using jwk and AES-GCM",
|
||||
"Can unwrap RSA-PSS private key non-extractable keys using jwk and AES-GCM",
|
||||
"Can wrap and unwrap HMAC keys using raw and AES-KW",
|
||||
"Can wrap and unwrap HMAC keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-CTR keys using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-CTR keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-CBC keys using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-CBC keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-GCM keys using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-KW keys using raw and AES-KW",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using raw and AES-KW",
|
||||
"Can wrap and unwrap RSA-OAEP public key keys using jwk and AES-KW",
|
||||
"Can wrap and unwrap RSASSA-PKCS1-v1_5 public key keys using jwk and AES-KW",
|
||||
"Can wrap and unwrap RSA-PSS public key keys using jwk and AES-KW",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using raw and RSA-OAEP",
|
||||
"Can wrap and unwrap AES-GCM keys as non-extractable using jwk and RSA-OAEP",
|
||||
"Can unwrap AES-GCM non-extractable keys using jwk and RSA-OAEP",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using raw and RSA-OAEP",
|
||||
"Can wrap and unwrap AES-KW keys as non-extractable using jwk and RSA-OAEP",
|
||||
"Can unwrap AES-KW non-extractable keys using jwk and RSA-OAEP"
|
||||
"Can unwrap AES-GCM non-extractable keys using jwk and RSA-OAEP"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue