RustCrypto / RSA

RSA implementation in pure Rust
Apache License 2.0
536 stars 146 forks source link

the function or associated item `new` exists for struct `SigningKey<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, UInt<UInt<UInt<..., ...>, ...>, ...>, ...>>>`, but its trait bounds were not satisfied [E0599] #401

Closed trouvaille2023 closed 9 months ago

trouvaille2023 commented 9 months ago

The code I copied from the official documentation will also generate errors. If there are any issues with the official documentation, what is the reference value when using it. How can I fix this error?

In the example, use rsa:: sha2:: {Digest, Sha256}; is used, But the latest version of rsa does not include sha2

version: 0.9.6

Official example code:

image

when I copy:

image

When I build it:

image
tarcieri commented 9 months ago

Note that the top of the documentation says the sha2 feature of the rsa crate must be enabled, but you have not enabled it.

If there are any issues with the official documentation, what is the reference value when using it.

Rust documentation is doctested, and we run those doctests in CI, so the examples are "guaranteed" to work, at least if the relevant features are enabled.

trouvaille2023 commented 9 months ago

Note that the top of the documentation says the sha2 feature of the rsa crate must be enabled, but you have not enabled it.

If there are any issues with the official documentation, what is the reference value when using it.

Rust documentation is doctested, and we run those doctests in CI, so the examples are "guaranteed" to work, at least if the relevant features are enabled.

Thank you, But I did not see from the official documentation that sha2 needs to be enabled,And When I enable it, it is worked.

tarcieri commented 9 months ago

I did not see from the official documentation that sha2 needs to be enabled

290379150-251e4769-8565-4062-8358-b9f0e0be78bd
trouvaille2023 commented 9 months ago

I did not see from the official documentation that sha2 needs to be enabled

290379150-251e4769-8565-4062-8358-b9f0e0be78bd

I did not see from the official documentation that sha2 needs to be enabled

290379150-251e4769-8565-4062-8358-b9f0e0be78bd

My mistake, thank you for your guidance.