| ... | ... | @@ -2596,9 +2596,31 @@ pub const Signature = union(enum) { |
| 2596 | 2596 | const sig = ns.Signature.fromBytes((r[0..C.scalar.encoded_length] ++ s[0..C.scalar.encoded_length]).*); |
| 2597 | 2597 | valid = if (sig.verify(signed_data.items, pk)) true else |_| false; |
| 2598 | 2598 | } |
| 2599 | if (std.mem.eql(u8, sigformat, "ecdsa-sha2-nistp384")) blk: { |
| 2600 | const C = std.crypto.ecc.P384; |
| 2601 | const H = std.crypto.hash.sha2.Sha384; |
| 2602 | const ns = std.crypto.sign.ecdsa.Ecdsa(C, H); |
| 2603 | const ident_len = pkfixed.readInt(u32, .big) catch break :blk; |
| 2604 | if (ident_len != "nistp384".len) break :blk; |
| 2605 | if (!(pkfixed.readExpected("nistp384") catch break :blk)) break :blk; |
| 2606 | const q_len = pkfixed.readInt(u32, .big) catch break :blk; |
| 2607 | const q = pkfixed.readSlice(q_len) catch break :blk; |
| 2608 | const pk = ns.PublicKey.fromSec1(q) catch break :blk; |
| 2609 | const sigblob_len = sigfixed.readInt(u32, .big) catch break :blk; |
| 2610 | _ = sigblob_len; |
| 2611 | const r_len = sigfixed.readInt(u32, .big) catch break :blk; |
| 2612 | var r = sigfixed.readSlice(r_len) catch break :blk; |
| 2613 | if (r[0] == 0) r = r[1..]; |
| 2614 | if (r.len != C.scalar.encoded_length) break :blk; |
| 2615 | const s_len = sigfixed.readInt(u32, .big) catch break :blk; |
| 2616 | var s = sigfixed.readSlice(s_len) catch break :blk; |
| 2617 | if (s[0] == 0) s = s[1..]; |
| 2618 | if (s.len != C.scalar.encoded_length) break :blk; |
| 2619 | const sig = ns.Signature.fromBytes((r[0..C.scalar.encoded_length] ++ s[0..C.scalar.encoded_length]).*); |
| 2620 | valid = if (sig.verify(signed_data.items, pk)) true else |_| false; |
| 2621 | } |
| 2599 | 2622 | // ssh-dss (dsa) |
| 2600 | 2623 | // sk-ecdsa-sha2-nistp256@openssh.com |
| 2601 | | // ecdsa-sha2-nistp384 |
| 2602 | 2624 | // ecdsa-sha2-nistp521 |
| 2603 | 2625 | // sk-ssh-ed25519@openssh.com |
| 2604 | 2626 | // rsa-sha2-256 |