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 {...@@ -56,7 +56,6 @@ pub const Attribute = enum {
56 organizationName,56 organizationName,
57 organizationalUnitName,57 organizationalUnitName,
58 organizationIdentifier,58 organizationIdentifier,
59 subject_alt_name,
60 pkcs9_emailAddress,59 pkcs9_emailAddress,
6160
62 pub const map = std.ComptimeStringMap(Attribute, .{61 pub const map = std.ComptimeStringMap(Attribute, .{
...@@ -68,7 +67,6 @@ pub const Attribute = enum {...@@ -68,7 +67,6 @@ pub const Attribute = enum {
68 .{ &[_]u8{ 0x55, 0x04, 0x0A }, .organizationName },67 .{ &[_]u8{ 0x55, 0x04, 0x0A }, .organizationName },
69 .{ &[_]u8{ 0x55, 0x04, 0x0B }, .organizationalUnitName },68 .{ &[_]u8{ 0x55, 0x04, 0x0B }, .organizationalUnitName },
70 .{ &[_]u8{ 0x55, 0x04, 0x61 }, .organizationIdentifier },69 .{ &[_]u8{ 0x55, 0x04, 0x61 }, .organizationIdentifier },
71 .{ &[_]u8{ 0x55, 0x1D, 0x11 }, .subject_alt_name },
72 .{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01 }, .pkcs9_emailAddress },70 .{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01 }, .pkcs9_emailAddress },
73 });71 });
74};72};
...@@ -78,7 +76,6 @@ pub const Parsed = struct {...@@ -78,7 +76,6 @@ pub const Parsed = struct {
78 issuer_slice: Slice,76 issuer_slice: Slice,
79 subject_slice: Slice,77 subject_slice: Slice,
80 common_name_slice: Slice,78 common_name_slice: Slice,
81 subject_alt_name_slice: Slice,
82 signature_slice: Slice,79 signature_slice: Slice,
83 signature_algorithm: Algorithm,80 signature_algorithm: Algorithm,
84 pub_key_algo: AlgorithmCategory,81 pub_key_algo: AlgorithmCategory,
...@@ -109,10 +106,6 @@ pub const Parsed = struct {...@@ -109,10 +106,6 @@ pub const Parsed = struct {
109 return p.slice(p.common_name_slice);106 return p.slice(p.common_name_slice);
110 }107 }
111108
112 pub fn subjectAltName(p: Parsed) []const u8 {
113 return p.slice(p.subject_alt_name_slice);
114 }
115
116 pub fn signature(p: Parsed) []const u8 {109 pub fn signature(p: Parsed) []const u8 {
117 return p.slice(p.signature_slice);110 return p.slice(p.signature_slice);
118 }111 }
...@@ -205,7 +198,6 @@ pub fn parse(cert: Certificate) !Parsed {...@@ -205,7 +198,6 @@ pub fn parse(cert: Certificate) !Parsed {
205 const pub_key = try parseBitString(cert, pub_key_elem);198 const pub_key = try parseBitString(cert, pub_key_elem);
206199
207 var common_name = der.Element.Slice.empty;200 var common_name = der.Element.Slice.empty;
208 var subject_alt_name = der.Element.Slice.empty;
209 var name_i = subject.slice.start;201 var name_i = subject.slice.start;
210 //std.debug.print("subject name:\n", .{});202 //std.debug.print("subject name:\n", .{});
211 while (name_i < subject.slice.end) {203 while (name_i < subject.slice.end) {
...@@ -223,7 +215,6 @@ pub fn parse(cert: Certificate) !Parsed {...@@ -223,7 +215,6 @@ pub fn parse(cert: Certificate) !Parsed {
223 //});215 //});
224 switch (ty) {216 switch (ty) {
225 .commonName => common_name = val.slice,217 .commonName => common_name = val.slice,
226 .subject_alt_name => subject_alt_name = val.slice,
227 else => {},218 else => {},
228 }219 }
229 atav_i = val.slice.end;220 atav_i = val.slice.end;
...@@ -242,7 +233,6 @@ pub fn parse(cert: Certificate) !Parsed {...@@ -242,7 +233,6 @@ pub fn parse(cert: Certificate) !Parsed {
242 return .{233 return .{
243 .certificate = cert,234 .certificate = cert,
244 .common_name_slice = common_name,235 .common_name_slice = common_name,
245 .subject_alt_name_slice = subject_alt_name,
246 .issuer_slice = issuer.slice,236 .issuer_slice = issuer.slice,
247 .subject_slice = subject.slice,237 .subject_slice = subject.slice,
248 .signature_slice = signature,238 .signature_slice = signature,