From f611a72e2eb7bba2ef5fc5f578ced3c711ff7374 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Tue, 14 Jul 2026 01:17:41 -0700 Subject: [PATCH] std.crypto.Certificate.rsa.PKCS1v1_5Signature: add DER for more hashes --- lib/std/crypto/Certificate.zig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/std/crypto/Certificate.zig b/lib/std/crypto/Certificate.zig index b725e932b418b36741ec2b4c38dbae7d6369c825..f0d18e58a130cd18d0eb8c00dba3b6f32903c802 100644 --- a/lib/std/crypto/Certificate.zig +++ b/lib/std/crypto/Certificate.zig @@ -1243,6 +1243,11 @@ pub const rsa = struct { // DigestInfo value (see the notes below) and let tLen be the length // in octets of T. const hash_der: []const u8 = &switch (Hash) { + crypto.hash.Md5 => .{ + 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, + 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, + 0x04, 0x10, + }, crypto.hash.Sha1 => .{ 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, @@ -1267,6 +1272,16 @@ pub const rsa = struct { 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40, }, + crypto.hash.sha3.Sha3_256 => .{ + 0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, + 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x08, 0x05, + 0x00, 0x04, 0x20, + }, + crypto.hash.sha3.Sha3_512 => .{ + 0x30, 0x51, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, + 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x0a, 0x05, + 0x00, 0x04, 0x40, + }, else => comptime unreachable, }; em_index -= hash_der.len; -- 2.54.0