Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

"unknown algorithm" error

未关闭
#334 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 8 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust
领域
cryptography

调研方向

从 Algorithm enum 和 PrivateKey::random 入口开始,使用 Cargo.toml 和 main.rs 中的示例重现运行时错误。跟踪算法功能的定义和门控方式,然后验证不可用的算法无法编译,或者会在当前的 "unknown algorithm" 运行时错误发生之前以其他方式被拒绝。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Rust
星标
247
派生
64
平均合并
4 天 7 小时
30 天内合并 PR
4

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RustCrypto/SSH 的其他 Issue

查看 RustCrypto/SSH 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。