authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-27 17:37:15-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-02 16:57:15-07:00
logb1cbfa0ec640c3a998e4a59352b93da37f359ff7
tree518efa9e6887f0995680538fdc57dab7ec07fd62
parentb24f178029f20cacb559b14e5e5e095fabea4e62

std.crypto.Certificate: remove subject_alt_name parsing

I believe this is provided as an extension, not in this location.

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

lib/std/crypto/Certificate.zig-10
......@@ -56,7 +56,6 @@ pub const Attribute = enum {
5656 organizationName,
5757 organizationalUnitName,
5858 organizationIdentifier,
59 subject_alt_name,
6059 pkcs9_emailAddress,
6160
6261 pub const map = std.ComptimeStringMap(Attribute, .{
......@@ -68,7 +67,6 @@ pub const Attribute = enum {
6867 .{ &[_]u8{ 0x55, 0x04, 0x0A }, .organizationName },
6968 .{ &[_]u8{ 0x55, 0x04, 0x0B }, .organizationalUnitName },
7069 .{ &[_]u8{ 0x55, 0x04, 0x61 }, .organizationIdentifier },
71 .{ &[_]u8{ 0x55, 0x1D, 0x11 }, .subject_alt_name },
7270 .{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01 }, .pkcs9_emailAddress },
7371 });
7472};
......@@ -78,7 +76,6 @@ pub const Parsed = struct {
7876 issuer_slice: Slice,
7977 subject_slice: Slice,
8078 common_name_slice: Slice,
81 subject_alt_name_slice: Slice,
8279 signature_slice: Slice,
8380 signature_algorithm: Algorithm,
8481 pub_key_algo: AlgorithmCategory,
......@@ -109,10 +106,6 @@ pub const Parsed = struct {
109106 return p.slice(p.common_name_slice);
110107 }
111108
112 pub fn subjectAltName(p: Parsed) []const u8 {
113 return p.slice(p.subject_alt_name_slice);
114 }
115
116109 pub fn signature(p: Parsed) []const u8 {
117110 return p.slice(p.signature_slice);
118111 }
......@@ -205,7 +198,6 @@ pub fn parse(cert: Certificate) !Parsed {
205198 const pub_key = try parseBitString(cert, pub_key_elem);
206199
207200 var common_name = der.Element.Slice.empty;
208 var subject_alt_name = der.Element.Slice.empty;
209201 var name_i = subject.slice.start;
210202 //std.debug.print("subject name:\n", .{});
211203 while (name_i < subject.slice.end) {
......@@ -223,7 +215,6 @@ pub fn parse(cert: Certificate) !Parsed {
223215 //});
224216 switch (ty) {
225217 .commonName => common_name = val.slice,
226 .subject_alt_name => subject_alt_name = val.slice,
227218 else => {},
228219 }
229220 atav_i = val.slice.end;
......@@ -242,7 +233,6 @@ pub fn parse(cert: Certificate) !Parsed {
242233 return .{
243234 .certificate = cert,
244235 .common_name_slice = common_name,
245 .subject_alt_name_slice = subject_alt_name,
246236 .issuer_slice = issuer.slice,
247237 .subject_slice = subject.slice,
248238 .signature_slice = signature,