authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-07-14 01:17:41-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-04 18:26:04-07:00
logf611a72e2eb7bba2ef5fc5f578ced3c711ff7374
tree5ff8bdf24e53c5ee7e3a4d2834eae061169460fd
parentfa515299f3b9bd9fc7aad4ad04dd862b1c925075

std.crypto.Certificate.rsa.PKCS1v1_5Signature: add DER for more hashes


1 files changed, 15 insertions(+), 0 deletions(-)

lib/std/crypto/Certificate.zig+15
...@@ -1243,6 +1243,11 @@ pub const rsa = struct {...@@ -1243,6 +1243,11 @@ pub const rsa = struct {
1243 // DigestInfo value (see the notes below) and let tLen be the length1243 // DigestInfo value (see the notes below) and let tLen be the length
1244 // in octets of T.1244 // in octets of T.
1245 const hash_der: []const u8 = &switch (Hash) {1245 const hash_der: []const u8 = &switch (Hash) {
1246 crypto.hash.Md5 => .{
1247 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86,
1248 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00,
1249 0x04, 0x10,
1250 },
1246 crypto.hash.Sha1 => .{1251 crypto.hash.Sha1 => .{
1247 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e,1252 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e,
1248 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14,1253 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14,
...@@ -1267,6 +1272,16 @@ pub const rsa = struct {...@@ -1267,6 +1272,16 @@ pub const rsa = struct {
1267 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05,1272 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05,
1268 0x00, 0x04, 0x40,1273 0x00, 0x04, 0x40,
1269 },1274 },
1275 crypto.hash.sha3.Sha3_256 => .{
1276 0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86,
1277 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x08, 0x05,
1278 0x00, 0x04, 0x20,
1279 },
1280 crypto.hash.sha3.Sha3_512 => .{
1281 0x30, 0x51, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86,
1282 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x0a, 0x05,
1283 0x00, 0x04, 0x40,
1284 },
1270 else => comptime unreachable,1285 else => comptime unreachable,
1271 };1286 };
1272 em_index -= hash_der.len;1287 em_index -= hash_der.len;