From 6a6c76a546d3a15acf4cfc00c5a8d127fa845fad Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 16 Jan 2023 16:30:28 -0800 Subject: [PATCH] std.crypto.Certificate: add more object ids --- lib/std/crypto/Certificate.zig | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/std/crypto/Certificate.zig b/lib/std/crypto/Certificate.zig index db984385bf2e..cd61b0f9e92a 100644 --- a/lib/std/crypto/Certificate.zig +++ b/lib/std/crypto/Certificate.zig @@ -15,6 +15,8 @@ pub const Algorithm = enum { ecdsa_with_SHA256, ecdsa_with_SHA384, ecdsa_with_SHA512, + md2WithRSAEncryption, + md5WithRSAEncryption, pub const map = std.ComptimeStringMap(Algorithm, .{ .{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05 }, .sha1WithRSAEncryption }, @@ -26,6 +28,8 @@ pub const Algorithm = enum { .{ &[_]u8{ 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02 }, .ecdsa_with_SHA256 }, .{ &[_]u8{ 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x03 }, .ecdsa_with_SHA384 }, .{ &[_]u8{ 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x04 }, .ecdsa_with_SHA512 }, + .{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x02 }, .md2WithRSAEncryption }, + .{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04 }, .md5WithRSAEncryption }, }); pub fn Hash(comptime algorithm: Algorithm) type { @@ -59,6 +63,7 @@ pub const Attribute = enum { organizationalUnitName, organizationIdentifier, pkcs9_emailAddress, + domainComponent, pub const map = std.ComptimeStringMap(Attribute, .{ .{ &[_]u8{ 0x55, 0x04, 0x03 }, .commonName }, @@ -70,6 +75,7 @@ pub const Attribute = enum { .{ &[_]u8{ 0x55, 0x04, 0x0B }, .organizationalUnitName }, .{ &[_]u8{ 0x55, 0x04, 0x61 }, .organizationIdentifier }, .{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01 }, .pkcs9_emailAddress }, + .{ &[_]u8{ 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x19 }, .domainComponent }, }); }; @@ -93,17 +99,40 @@ pub const ExtensionId = enum { crl_number, certificate_policies, authority_key_identifier, + msCertsrvCAVersion, + commonName, + ext_key_usage, + crl_distribution_points, + info_access, + entrustVersInfo, + enroll_certtype, + pe_logotype, + netscape_cert_type, + netscape_comment, pub const map = std.ComptimeStringMap(ExtensionId, .{ + .{ &[_]u8{ 0x55, 0x04, 0x03 }, .commonName }, + .{ &[_]u8{ 0x55, 0x1D, 0x01 }, .authority_key_identifier }, + .{ &[_]u8{ 0x55, 0x1D, 0x07 }, .subject_alt_name }, .{ &[_]u8{ 0x55, 0x1D, 0x0E }, .subject_key_identifier }, .{ &[_]u8{ 0x55, 0x1D, 0x0F }, .key_usage }, + .{ &[_]u8{ 0x55, 0x1D, 0x0A }, .basic_constraints }, .{ &[_]u8{ 0x55, 0x1D, 0x10 }, .private_key_usage_period }, .{ &[_]u8{ 0x55, 0x1D, 0x11 }, .subject_alt_name }, .{ &[_]u8{ 0x55, 0x1D, 0x12 }, .issuer_alt_name }, .{ &[_]u8{ 0x55, 0x1D, 0x13 }, .basic_constraints }, .{ &[_]u8{ 0x55, 0x1D, 0x14 }, .crl_number }, + .{ &[_]u8{ 0x55, 0x1D, 0x1F }, .crl_distribution_points }, .{ &[_]u8{ 0x55, 0x1D, 0x20 }, .certificate_policies }, .{ &[_]u8{ 0x55, 0x1D, 0x23 }, .authority_key_identifier }, + .{ &[_]u8{ 0x55, 0x1D, 0x25 }, .ext_key_usage }, + .{ &[_]u8{ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x01 }, .msCertsrvCAVersion }, + .{ &[_]u8{ 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01 }, .info_access }, + .{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF6, 0x7D, 0x07, 0x41, 0x00 }, .entrustVersInfo }, + .{ &[_]u8{ 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x14, 0x02 }, .enroll_certtype }, + .{ &[_]u8{ 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x0c }, .pe_logotype }, + .{ &[_]u8{ 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x01 }, .netscape_cert_type }, + .{ &[_]u8{ 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x0d }, .netscape_comment }, }); };