authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-07-17 11:44:21 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-07-17 11:44:21 -07:00
log6c48e1c3954aa4f361941eaf565570fabef93685
tree24d341e2c48c1e693f0a0cf8232ae1d48c863cee
parente9bd5b789ffdad8f6be2c329be14e5aa4dcd678d
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

Signature: ssh: support rsa-sha2-256


1 files changed, 13 insertions(+), 1 deletions(-)

git.zig+13-1
......@@ -2562,6 +2562,19 @@ pub const Signature = union(enum) {
25622562 if (std.mem.eql(u8, sigformat, "ssh-rsa")) {
25632563 // intentionally skipped, rsa with sha1
25642564 }
2565 if (std.mem.eql(u8, sigformat, "rsa-sha2-256")) blk: {
2566 const ns = std.crypto.Certificate.rsa;
2567 const pk_e_len = pkfixed.readInt(u32, .big) catch break :blk;
2568 var pk_e = pkfixed.readSlice(pk_e_len) catch break :blk;
2569 if (pk_e[0] == 0) pk_e = pk_e[1..];
2570 const pk_n_len = pkfixed.readInt(u32, .big) catch break :blk;
2571 var pk_n = pkfixed.readSlice(pk_n_len) catch break :blk;
2572 if (pk_n[0] == 0) pk_n = pk_n[1..];
2573 const pk = ns.PublicKey.fromBytes(pk_e, pk_n) catch break :blk;
2574 const sig_len = sigfixed.readInt(u32, .big) catch break :blk;
2575 const sig = sigfixed.readSlice(sig_len) catch break :blk;
2576 valid = if (pgp_rsa_verify(pk_n.len, sig, signed_data.items, pk, .sha2_256)) true else |err| if (err == error.unrecognized) null else false;
2577 }
25652578 if (std.mem.eql(u8, sigformat, "ssh-ed25519")) blk: {
25662579 const ed = std.crypto.sign.Ed25519;
25672580 const pk_len = pkfixed.readInt(u32, .big) catch break :blk;
......@@ -2623,7 +2636,6 @@ pub const Signature = union(enum) {
26232636 // ssh-dss (dsa)
26242637 // sk-ecdsa-sha2-nistp256@openssh.com
26252638 // sk-ssh-ed25519@openssh.com
2626 // rsa-sha2-256
26272639 // rsa-sha2-512
26282640
26292641 return .{ .ssh = .{