Uh oh!
There was an error while loading. Please reload this page.
Refactor PaddingScheme into a trait - #244
Conversation
tarcieri
commented
Jan 6, 2023
cc @lumag |
tarcieri
commented
Jan 6, 2023
Note that there's various additional refactoring that could probably be performed, like getting rid of the inherent methods for these functionality and using the traits exclusively, or getting rid of the I deliberately didn't make any of those kinds of changes to make code review easier. |
ef9650b to
610d257CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dignifiedquire
commented
Jan 6, 2023
I overall very much like this approach, it makes the API clearer to understand and reason about. |
tarcieri
commented
Jan 9, 2023
@dignifiedquire this should be good to go now |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Splits up the `PaddingScheme` enum into four structs, named after the
previous variants of the struct (adopting capitalization from the Rust
API guidelines):
- `oaep::Oaep`
- `pkcs1v15::{Pkcs1v15Encrypt, Pkcs1v15Sign}`
- `pss::Pss`
All of these are re-exported from the toplevel.
Each of these structs impls one or more of the following traits:
- `PaddingScheme`: used for encryption
- `SignatureScheme`: used for signing
The `PaddingScheme` constructors have been remapped as follows:
- `new_oaep` => `Oaep::new`
- `new_oaep_with_label` => `Oaep::new_with_label`
- `new_oaep_with_mgf_hash` => `Oaep::new_with_mgf_hash`
- `new_oaep_with_mgf_hash_with_label` => `Oaep::new_with_mgf_hash_and_label`
- `new_pkcs1v15_encrypt` => `Pkcs1v15Encrypt`
- `new_pkcs1v15_sign` => `Pkcs1v15Sign::new`
- `new_pkcs1v15_sign_raw` => `Pkcs1v15Sign::new_raw`
- `new_pss` => `Pss::{new, new_blinded}`
- `new_pss_with_salt` => `Pss::{new_with_salt new_blinded_with_salt}`69c9ba0 to
dc47326CompareResolve incompatibilities as follows: - src/certificate.rs: RustCrypto/formats#771 - src/cmd/serve.rs: Move to FromRequestParts and use headers crate - src/ecdsa_sha256.rs: RustCrypto/traits#1196 and RustCrypto/signatures#574 - src/error.rs: Remove Duplicates - src/identity.rs: Remove owned validation logic as it should be done at x509_cert::serial_number::SerialNumber<x509_cert::certificate::Rfc5280> - src/sign.rs: RustCrypto/RSA#244
Splits up the `PaddingScheme` enum into four structs, named after the
previous variants of the struct (adopting capitalization from the Rust
API guidelines):
- `oaep::Oaep`
- `pkcs1v15::{Pkcs1v15Encrypt, Pkcs1v15Sign}`
- `pss::Pss`
All of these are re-exported from the toplevel.
Each of these structs impls one or more of the following traits:
- `PaddingScheme`: used for encryption
- `SignatureScheme`: used for signing
The `PaddingScheme` constructors have been remapped as follows:
- `new_oaep` => `Oaep::new`
- `new_oaep_with_label` => `Oaep::new_with_label`
- `new_oaep_with_mgf_hash` => `Oaep::new_with_mgf_hash`
- `new_oaep_with_mgf_hash_with_label` => `Oaep::new_with_mgf_hash_and_label`
- `new_pkcs1v15_encrypt` => `Pkcs1v15Encrypt`
- `new_pkcs1v15_sign` => `Pkcs1v15Sign::new`
- `new_pkcs1v15_sign_raw` => `Pkcs1v15Sign::new_raw`
- `new_pss` => `Pss::{new, new_blinded}`
- `new_pss_with_salt` => `Pss::{new_with_salt new_blinded_with_salt}`
As proposed in #226, splits up the
PaddingSchemeenum into four structs, named after the previous variants of the struct (adopting capitalization from the Rust API guidelines):oaep::Oaeppkcs1v15::{Pkcs1v15Encrypt, Pkcs1v15Sign}pss::PssAll of these are re-exported from the toplevel.
Each of these structs impls one or more of the following traits:
PaddingScheme: used for encryptionSignatureScheme: used for signingThe
PaddingSchemeconstructors have been remapped as follows:new_oaep=>Oaep::newnew_oaep_with_label=>Oaep::new_with_labelnew_oaep_with_mgf_hash=>Oaep::new_with_mgf_hashnew_oaep_with_mgf_hash_with_label=>Oaep::new_with_mgf_hash_and_labelnew_pkcs1v15_encrypt=>Pkcs1v15Encryptnew_pkcs1v15_sign=>Pkcs1v15Sign::newnew_pkcs1v15_sign_raw=>Pkcs1v15Sign::new_rawnew_pss=>Pss::{new, new_blinded}new_pss_with_salt=>Pss::{new_with_salt new_blinded_with_salt}