diff --git a/Cargo.lock b/Cargo.lock index 8e879cdd..f5f85b8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,17 +2,40 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aead" +version = "0.6.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5f451b77e2f92932dc411da6ef9f3d33efad68a6f14a7a83e559453458e85ac" +dependencies = [ + "crypto-common", +] + [[package]] name = "aes" -version = "0.8.4" +version = "0.9.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +checksum = "183b3b4639f8f7237857117abb74f3dc8648b77e67ff78d9cb6959fd7e76f387" dependencies = [ "cfg-if", "cipher", "cpufeatures", ] +[[package]] +name = "aes-gcm" +version = "0.11.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4ca4317859cecdb9849cf94087998a04efc7beedc07855836cb2534fd9aa4db" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + [[package]] name = "autocfg" version = "1.3.0" @@ -54,29 +77,20 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.11.0-pre.5" +version = "0.11.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ded684142010808eb980d9974ef794da2bcf97d13396143b1515e9f0fb4a10e" +checksum = "17092d478f4fadfb35a7e082f62e49f0907fdf048801d9d706277e34f9df8a78" dependencies = [ - "crypto-common 0.2.0-pre.5", + "crypto-common", ] [[package]] name = "block-padding" -version = "0.3.3" +version = "0.4.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +checksum = "0d7992d59cd95a984bde8833d4d025886eec3718777971ad15c58df0b070254a" dependencies = [ - "generic-array", + "hybrid-array", ] [[package]] @@ -87,9 +101,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cbc" -version = "0.1.2" +version = "0.2.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +checksum = "1f400d6c533c8e3b0545892ac95831d897c816335fec5d2d57d886a241acf13e" dependencies = [ "cipher", ] @@ -102,19 +116,19 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cipher" -version = "0.4.4" +version = "0.5.0-pre.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +checksum = "c71c893d5a1e8257048dbb29954d2e1f85f091a150304f1defe4ca2806da5d3f" dependencies = [ - "crypto-common 0.1.6", + "crypto-common", "inout", ] [[package]] name = "const-oid" -version = "0.10.0-pre.2" +version = "0.10.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e3352a27098ba6b09546e5f13b15165e6a88b5c2723afecb3ea9576b27e3ea" +checksum = "9adcf94f05e094fca3005698822ec791cb4433ced416afda1c5ca3b8dfc05a2f" [[package]] name = "cpufeatures" @@ -140,19 +154,9 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "crypto-common" -version = "0.2.0-pre.5" +version = "0.2.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7aa2ec04f5120b830272a481e8d9d8ba4dda140d2cda59b0f1110d5eb93c38e" +checksum = "8c070b79a496dccd931229780ad5bbedd535ceff6c3565605a8e440e18e1aa2b" dependencies = [ "getrandom", "hybrid-array", @@ -170,36 +174,35 @@ dependencies = [ ] [[package]] -name = "der" -version = "0.8.0-pre.0" +name = "ctr" +version = "0.10.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b489fd2221710c1dd46637d66b984161fb66134f81437a8489800306bcc2ecea" +checksum = "7f1637b299862a663dd5af70ee109d53555eff68b99b454fe535ed6599b0e9b3" dependencies = [ - "const-oid", - "pem-rfc7468", - "zeroize", + "cipher", ] [[package]] -name = "digest" -version = "0.10.7" +name = "der" +version = "0.8.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "05d9c07d3bd80cf0935ce478d07edf7e7a5b158446757f988f3e62082227b700" dependencies = [ - "block-buffer 0.10.4", - "crypto-common 0.1.6", - "subtle", + "const-oid", + "pem-rfc7468", + "zeroize", ] [[package]] name = "digest" -version = "0.11.0-pre.8" +version = "0.11.0-pre.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065d93ead7c220b85d5b4be4795d8398eac4ff68b5ee63895de0a3c1fb6edf25" +checksum = "cf2e3d6615d99707295a9673e889bf363a04b2a466bd320c65a72536f7577379" dependencies = [ - "block-buffer 0.11.0-pre.5", + "block-buffer", "const-oid", - "crypto-common 0.2.0-pre.5", + "crypto-common", + "subtle", ] [[package]] @@ -224,16 +227,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - [[package]] name = "getrandom" version = "0.2.15" @@ -245,6 +238,16 @@ dependencies = [ "wasi", ] +[[package]] +name = "ghash" +version = "0.6.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b92860fda25ab571512af210134cde2c42732cd53253bcee3f21b288b7afbc4" +dependencies = [ + "opaque-debug", + "polyval", +] + [[package]] name = "hex-literal" version = "0.4.1" @@ -253,11 +256,11 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hmac" -version = "0.12.1" +version = "0.13.0-pre.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "e4b1fb14e4df79f9406b434b60acef9f45c26c50062cccf1346c6103b8c47d58" dependencies = [ - "digest 0.10.7", + "digest", ] [[package]] @@ -271,12 +274,12 @@ dependencies = [ [[package]] name = "inout" -version = "0.1.3" +version = "0.2.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "bbc33218cf9ce7b927426ee4ad3501bcc5d8c26bf5fb4a82849a083715aca427" dependencies = [ "block-padding", - "generic-array", + "hybrid-array", ] [[package]] @@ -328,30 +331,36 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "pbkdf2" -version = "0.12.2" +version = "0.13.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +checksum = "85e11753d5193f26dc27ae698e0b536b5e511b7799c5ac475ec10783f26d164a" dependencies = [ - "digest 0.10.7", + "digest", "hmac", ] [[package]] name = "pem-rfc7468" -version = "1.0.0-pre.0" +version = "1.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a65e1c27d1680f8805b3f8c9949f08d6aa5d6cbd088c9896e64a53821dc27d" +checksum = "b6c1cde4770761bf6bd336f947b9ac1fe700b0a4ec5867cf66cf08597fe89e8c" dependencies = [ "base64ct", ] [[package]] name = "pkcs1" -version = "0.8.0-pre.0" +version = "0.8.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f6af6e88ac39402f67488e22faa9eb15cf065f520cf4a09419393691a6d0133" +checksum = "0d2f4c73d459a85331915baebd5082dce5ee8ef16fd9a1ca75559ac91e66a9ee" dependencies = [ "der", "pkcs8", @@ -360,24 +369,26 @@ dependencies = [ [[package]] name = "pkcs5" -version = "0.8.0-pre.0" +version = "0.8.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6aebdab8ec0fe71f347de8d37212be79ccdedeb0f46133b0cf2bc5f6d2c65a" +checksum = "8484e50aebd8230b892aaefb7d8db017de6027249838d42e6c70a17d6c888f75" dependencies = [ "aes", + "aes-gcm", "cbc", "der", "pbkdf2", + "rand_core", "scrypt", - "sha2 0.10.8", + "sha2", "spki", ] [[package]] name = "pkcs8" -version = "0.11.0-pre.0" +version = "0.11.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "935c09e0aecb0cb8f8907b57438b19a068cb74a25189b06724f061170b2465ff" +checksum = "66180445f1dce533620a7743467ef85fe1c5e80cdaf7c7053609d7a2fbcdae20" dependencies = [ "der", "pkcs5", @@ -385,6 +396,18 @@ dependencies = [ "spki", ] +[[package]] +name = "polyval" +version = "0.7.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b01cbf5c028f9f862c6f7f5a5544307d7858634df190488d432ec470c8fbc063" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + [[package]] name = "ppv-lite86" version = "0.2.20" @@ -485,13 +508,13 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rsa" -version = "0.10.0-pre.1" +version = "0.10.0-pre.2" dependencies = [ "base64ct", "const-oid", "crypto-bigint", "crypto-primes", - "digest 0.11.0-pre.8", + "digest", "hex-literal", "pkcs1", "pkcs8", @@ -504,7 +527,7 @@ dependencies = [ "serde_test", "serdect", "sha1", - "sha2 0.11.0-pre.3", + "sha2", "sha3", "signature", "spki", @@ -539,22 +562,23 @@ dependencies = [ [[package]] name = "salsa20" -version = "0.10.2" +version = "0.11.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +checksum = "ea4ef53595bd236cf843530a2db25c792acb34e619320d0423e6cbc6d8e3c8c5" dependencies = [ + "cfg-if", "cipher", ] [[package]] name = "scrypt" -version = "0.11.0" +version = "0.12.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +checksum = "2d3b72607db59bcdf41734bf35ca0d1589a2187fa5ec2f75ff4c61c55ca4dc2c" dependencies = [ "pbkdf2", "salsa20", - "sha2 0.10.8", + "sha2", ] [[package]] @@ -598,62 +622,51 @@ dependencies = [ [[package]] name = "sha1" -version = "0.11.0-pre.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3885de8cb916f223718c1ccd47a840b91f806333e76002dc5cb3862154b4fed3" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.11.0-pre.8", -] - -[[package]] -name = "sha2" -version = "0.10.8" +version = "0.11.0-pre.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "9540978cef7a8498211c1b1c14e5ce920fe5bd524ea84f4a3d72d4602515ae93" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] name = "sha2" -version = "0.11.0-pre.3" +version = "0.11.0-pre.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f33549bf3064b62478926aa89cbfc7c109aab66ae8f0d5d2ef839e482cc30d6" +checksum = "540c0893cce56cdbcfebcec191ec8e0f470dd1889b6e7a0b503e310a94a168f5" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.11.0-pre.8", + "digest", ] [[package]] name = "sha3" -version = "0.11.0-pre.3" +version = "0.11.0-pre.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f32c02b9987a647a3d6af14c3e88df86594e4283050d9d8ee3a035df247785b9" +checksum = "e485881f388c2818d709796dc883c1ffcadde9d1f0e054f3a5c14974185261a6" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "keccak", ] [[package]] name = "signature" -version = "2.3.0-pre.3" +version = "2.3.0-pre.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1700c22ba9ce32c7b0a1495068a906c3552e7db386af7cf865162e0dea498523" +checksum = "054d71959c7051b9042c26af337f05cc930575ed2604d7d3ced3158383e59734" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "rand_core", ] [[package]] name = "spki" -version = "0.8.0-pre.0" +version = "0.8.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb2b56670f5ef52934c97efad30bf42585de0c33ec3e2a886e38b80d2db67243" +checksum = "ee3fb1c675852398475928637b3ebbdd7e1d0cc24d27b3bbc81788b4eb51e310" dependencies = [ "base64ct", "der", @@ -708,10 +721,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] -name = "version_check" -version = "0.9.5" +name = "universal-hash" +version = "0.6.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "3517d72c5ca6d60f9f2e85d2c772e2652830062a685105a528d19dd823cf87d5" +dependencies = [ + "crypto-common", + "subtle", +] [[package]] name = "wait-timeout" diff --git a/Cargo.toml b/Cargo.toml index f3e489a4..3f429959 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsa" -version = "0.10.0-pre.1" +version = "0.10.0-pre.2" authors = ["RustCrypto Developers", "dignifiedquire "] edition = "2021" description = "Pure Rust RSA implementation" @@ -14,21 +14,21 @@ rust-version = "1.73" [dependencies] rand_core = { version = "0.6.4", default-features = false } -const-oid = { version = "=0.10.0-pre.2", default-features = false } +const-oid = { version = "=0.10.0-rc.0", default-features = false } subtle = { version = "2.6.1", default-features = false } -digest = { version = "=0.11.0-pre.8", default-features = false, features = ["alloc", "oid"] } -pkcs1 = { version = "=0.8.0-pre.0", default-features = false, features = ["alloc", "pkcs8"] } -pkcs8 = { version = "=0.11.0-pre.0", default-features = false, features = ["alloc"] } -signature = { version = "=2.3.0-pre.3", default-features = false , features = ["alloc", "digest", "rand_core"] } -spki = { version = "=0.8.0-pre.0", default-features = false, features = ["alloc"] } +digest = { version = "=0.11.0-pre.9", default-features = false, features = ["alloc", "oid"] } +pkcs1 = { version = "=0.8.0-rc.0", default-features = false, features = ["alloc", "pkcs8"] } +pkcs8 = { version = "=0.11.0-rc.0", default-features = false, features = ["alloc"] } +signature = { version = "=2.3.0-pre.4", default-features = false , features = ["alloc", "digest", "rand_core"] } +spki = { version = "=0.8.0-rc.0", default-features = false, features = ["alloc"] } zeroize = { version = "1.5", features = ["alloc"] } crypto-bigint = { version = "0.6.0-rc.2", default-features = false, features = ["zeroize", "alloc"] } crypto-primes = { version = "0.6.0-pre.0" } # optional dependencies -sha1 = { version = "=0.11.0-pre.3", optional = true, default-features = false, features = ["oid"] } +sha1 = { version = "=0.11.0-pre.4", optional = true, default-features = false, features = ["oid"] } serdect = { version = "0.2.0", optional = true } -sha2 = { version = "=0.11.0-pre.3", optional = true, default-features = false, features = ["oid"] } +sha2 = { version = "=0.11.0-pre.4", optional = true, default-features = false, features = ["oid"] } serde = { version = "1.0.184", optional = true, default-features = false, features = ["derive"] } [dev-dependencies] @@ -40,9 +40,9 @@ rand_xorshift = "0.3" rand_chacha = "0.3" rand = "0.8" rand_core = { version = "0.6", default-features = false } -sha1 = { version = "=0.11.0-pre.3", default-features = false, features = ["oid"] } -sha2 = { version = "=0.11.0-pre.3", default-features = false, features = ["oid"] } -sha3 = { version = "=0.11.0-pre.3", default-features = false, features = ["oid"] } +sha1 = { version = "=0.11.0-pre.4", default-features = false, features = ["oid"] } +sha2 = { version = "=0.11.0-pre.4", default-features = false, features = ["oid"] } +sha3 = { version = "=0.11.0-pre.4", default-features = false, features = ["oid"] } [[bench]] name = "key" diff --git a/src/oaep.rs b/src/oaep.rs index faac7d67..4fd30297 100644 --- a/src/oaep.rs +++ b/src/oaep.rs @@ -245,8 +245,6 @@ fn decrypt( mgf_digest: &mut dyn DynDigest, label: Option, ) -> Result> { - key::check_public(priv_key)?; - if ciphertext.len() != priv_key.size() { return Err(Error::Decryption); }