Open tarcieri opened 2 years ago
could be fixed by using newtypes around the generic core, rather than just type aliases.
It will involve a quite significant amount of boilerplate in every hash crate.
I think with some experimentation we can find a solution which allows newtypes for each hash type while minimizing per-crate boilerplate.
Alternatively perhaps we could find more meaningful names for the generic types which make the generic types more readable.
Or a combination thereof.
In https://github.com/RustCrypto/RSA/pull/179 we ran into a somewhat related issue:
It would be nice to be able to use the const_oid::AssociatedOid
trait to associate an OID with types like Sha224
/Sha256
/Sha384
/Sha512
.
Unfortunately this isn't possible because these types are actually CoreWrapper<CtVariableCoreWrapper<...>
as defined by the digest
crate.
Something I think is worth noting is the orphan rules would probably permit such an impl if the inner generic type were defined in the current crate (leveraging the same exemption From
uses), but that doesn't work with multiple layers of generics like this.
I think digest
can implement AssociatedOid
for the wrappers if a wrapped type implements it. In other words, we would implement AssociatedOid
for core types and digest
will handle "bubbling" it to the types used by users.
Potentially relevant issue: https://github.com/rust-lang/rust/issues/66751
Re: newtypes, using macros for delegation is one option as mentioned here: https://github.com/RustCrypto/traits/pull/1098#issuecomment-1239838329
FWIW I don't think it's a terrible option. Macros are best used as stopgaps for missing language features, and I think the lack of first-class delegation support (especially in a composition-over-inheritance language) is a reasonable use case for macros. I also think lack of first-class delegation is somewhat widely recognized as a deficiency in Rust which should eventually get addressed somehow. See https://github.com/rust-lang/rfcs/pull/2393
We use them for solving a similar problem related to AssociatedOid
here: https://docs.rs/x509-cert/latest/x509_cert/macro.impl_newtype.html
Alternatively Deref
could be used, potentially in combination with macros.
Along these same lines, the error messages for when a digest type fails to impl the #1098 approach to AssociatedOid
makes for a fairly inscrutable error message:
error[E0599]: the function or associated item `new_with_prefix` exists for struct `rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>`, but its trait bounds were not satisfied
--> ssh-key/src/signature.rs:403:52
|
403 | let data = pkcs1v15::SigningKey::<Sha512>::new_with_prefix(self)
| ^^^^^^^^^^^^^^^ function or associated item cannot be called on `rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>` due to unsatisfied trait bounds
|
::: /Users/bascule/.cargo/registry/src/github.com-1ecc6299db9ec823/rsa-0.7.0-rc.0/src/pkcs1v15.rs:306:1
|
306 | pub struct SigningKey<D>
| ------------------------
| |
| doesn't satisfy `_: Default`
| doesn't satisfy `_: FixedOutput`
| doesn't satisfy `_: HashMarker`
| doesn't satisfy `_: Update`
| doesn't satisfy `_: sha2::Digest`
|
::: /Users/bascule/.cargo/registry/src/github.com-1ecc6299db9ec823/digest-0.10.5/src/core_api/wrapper.rs:24:1
|
24 | pub struct CoreWrapper<T>
| ------------------------- doesn't satisfy `_: AssociatedOid`
|
= note: the following trait bounds were not satisfied:
`CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>: AssociatedOid`
...and for me this error continues (possibly unrelated):
`rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: FixedOutput`
which is required by `rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Default`
which is required by `rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Update`
which is required by `rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: HashMarker`
which is required by `rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: FixedOutput`
which is required by `&rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Default`
which is required by `&rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Update`
which is required by `&rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: HashMarker`
which is required by `&rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&mut rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: FixedOutput`
which is required by `&mut rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&mut rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Default`
which is required by `&mut rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&mut rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Update`
which is required by `&mut rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&mut rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: HashMarker`
which is required by `&mut rsa::pkcs1v15::SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
error[E0599]: the function or associated item `new_with_prefix` exists for struct `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>`, but its trait bounds were not satisfied
--> ssh-key/src/signature.rs:427:51
|
427 | pkcs1v15::VerifyingKey::<Sha256>::new_with_prefix(self)
| ^^^^^^^^^^^^^^^ function or associated item cannot be called on `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>` due to unsatisfied trait bounds
|
::: /Users/bascule/.cargo/registry/src/github.com-1ecc6299db9ec823/rsa-0.7.0-rc.0/src/pkcs1v15.rs:406:1
|
406 | pub struct VerifyingKey<D>
| --------------------------
| |
| doesn't satisfy `_: Default`
| doesn't satisfy `_: FixedOutput`
| doesn't satisfy `_: HashMarker`
| doesn't satisfy `_: Update`
| doesn't satisfy `_: sha2::Digest`
|
::: /Users/bascule/.cargo/registry/src/github.com-1ecc6299db9ec823/digest-0.10.5/src/core_api/wrapper.rs:24:1
|
24 | pub struct CoreWrapper<T>
| ------------------------- doesn't satisfy `_: AssociatedOid`
|
= note: the following trait bounds were not satisfied:
`CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>: AssociatedOid`
`rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: FixedOutput`
which is required by `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: Default`
which is required by `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: Update`
which is required by `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: HashMarker`
which is required by `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: FixedOutput`
which is required by `&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: Default`
which is required by `&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: Update`
which is required by `&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: HashMarker`
which is required by `&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: FixedOutput`
which is required by `&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: Default`
which is required by `&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: Update`
which is required by `&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
`&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: HashMarker`
which is required by `&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>: sha2::Digest`
error[E0599]: the function or associated item `new_with_prefix` exists for struct `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>`, but its trait bounds were not satisfied
--> ssh-key/src/signature.rs:435:51
|
435 | pkcs1v15::VerifyingKey::<Sha512>::new_with_prefix(self)
| ^^^^^^^^^^^^^^^ function or associated item cannot be called on `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>` due to unsatisfied trait bounds
|
::: /Users/bascule/.cargo/registry/src/github.com-1ecc6299db9ec823/rsa-0.7.0-rc.0/src/pkcs1v15.rs:406:1
|
406 | pub struct VerifyingKey<D>
| --------------------------
| |
| doesn't satisfy `_: Default`
| doesn't satisfy `_: FixedOutput`
| doesn't satisfy `_: HashMarker`
| doesn't satisfy `_: Update`
| doesn't satisfy `_: sha2::Digest`
|
::: /Users/bascule/.cargo/registry/src/github.com-1ecc6299db9ec823/digest-0.10.5/src/core_api/wrapper.rs:24:1
|
24 | pub struct CoreWrapper<T>
| ------------------------- doesn't satisfy `_: AssociatedOid`
|
= note: the following trait bounds were not satisfied:
`CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>: AssociatedOid`
`rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: FixedOutput`
which is required by `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Default`
which is required by `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Update`
which is required by `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: HashMarker`
which is required by `rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: FixedOutput`
which is required by `&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Default`
which is required by `&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Update`
which is required by `&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: HashMarker`
which is required by `&rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: FixedOutput`
which is required by `&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Default`
which is required by `&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: Update`
which is required by `&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
`&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: HashMarker`
which is required by `&mut rsa::pkcs1v15::VerifyingKey<CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, OidSha512>>>: sha2::Digest`
A note re: above: it becomes very very hard to tell what's happening when dealing with errors like above but trying to figure out e.g. Sha256
vs Sha512
, as these are:
CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>
CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<signature::digest::typenum::UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>>
There is just so much syntactic noise the actual important parts become very difficult to find/compare.
The solution to all of the above was to enable the oid
feature of sha2
, however arriving at that was incredibly counterintuitive given the error messages, and that's coming from the perspective of a developer of these crates.
For now we're going to need to make all of this very clear in the documentation, with examples of the error messages and suggested resolutions.
Most of the noise comes from typenum
, with const generics we would get something like CoreWrapper<CtVariableCoreWrapper<Sha512VarCore, 64>>>
, which is not ideal, but still much better. I wonder if something like this could help eventually.
Regardless of the horrible error messages, maybe we should make the oid
feature enabled by default or even make it non-gated in the next breaking releases?
Digest now makes use of several vaguely-named generic wrapper structs and type aliases to give them human-readable names.
This makes both the type names emitted by rustc and the resulting rustdoc harder to read, as they render the canonical type name rather than the type alias.
For example, what used to render in rustdoc as:
now renders as:
e.g. https://docs.rs/k256/0.11.3/k256/schnorr/struct.Signature.html#impl-PrehashSignature
I think this usability issue and various others (e.g. confusing error messages relating to blanket impls of sealed traits) could be fixed by using newtypes around the generic core, rather than just type aliases.