-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Using ssh-key to create a new PrivateKey using an algorithm which doesn't have the correct crate feature enabled results in a runtime error (unknown algorithm).
The following code compiles fine but panics with an error at runtime.
# Cargo.toml
[dependencies]
ssh-key = "0.6"// main.rs
use ssh_key::rand_core::OsRng;
use ssh_key::{Algorithm, PrivateKey};
fn main() {
let private_key = PrivateKey::random(&mut OsRng, Algorithm::Ed25519).unwrap();
dbg!(&private_key);
}This is not very rusty. It would be much less surprising if the enum variant Ed25519 of the Algorithm enum would also be guarded by the feature that enables the algorithm.
Metadata
Metadata
Assignees
Labels
No labels