mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
std.crypto.Certificate: add more object ids
This commit is contained in:
parent
09560bc69a
commit
62e3fdcf4f
@ -15,6 +15,8 @@ pub const Algorithm = enum {
|
|||||||
ecdsa_with_SHA256,
|
ecdsa_with_SHA256,
|
||||||
ecdsa_with_SHA384,
|
ecdsa_with_SHA384,
|
||||||
ecdsa_with_SHA512,
|
ecdsa_with_SHA512,
|
||||||
|
md2WithRSAEncryption,
|
||||||
|
md5WithRSAEncryption,
|
||||||
|
|
||||||
pub const map = std.ComptimeStringMap(Algorithm, .{
|
pub const map = std.ComptimeStringMap(Algorithm, .{
|
||||||
.{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05 }, .sha1WithRSAEncryption },
|
.{ &[_]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, 0x02 }, .ecdsa_with_SHA256 },
|
||||||
.{ &[_]u8{ 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x03 }, .ecdsa_with_SHA384 },
|
.{ &[_]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, 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 {
|
pub fn Hash(comptime algorithm: Algorithm) type {
|
||||||
@ -35,6 +39,8 @@ pub const Algorithm = enum {
|
|||||||
.ecdsa_with_SHA256, .sha256WithRSAEncryption => crypto.hash.sha2.Sha256,
|
.ecdsa_with_SHA256, .sha256WithRSAEncryption => crypto.hash.sha2.Sha256,
|
||||||
.ecdsa_with_SHA384, .sha384WithRSAEncryption => crypto.hash.sha2.Sha384,
|
.ecdsa_with_SHA384, .sha384WithRSAEncryption => crypto.hash.sha2.Sha384,
|
||||||
.ecdsa_with_SHA512, .sha512WithRSAEncryption => crypto.hash.sha2.Sha512,
|
.ecdsa_with_SHA512, .sha512WithRSAEncryption => crypto.hash.sha2.Sha512,
|
||||||
|
.md2WithRSAEncryption => @compileError("unimplemented"),
|
||||||
|
.md5WithRSAEncryption => crypto.hash.Md5,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -59,6 +65,7 @@ pub const Attribute = enum {
|
|||||||
organizationalUnitName,
|
organizationalUnitName,
|
||||||
organizationIdentifier,
|
organizationIdentifier,
|
||||||
pkcs9_emailAddress,
|
pkcs9_emailAddress,
|
||||||
|
domainComponent,
|
||||||
|
|
||||||
pub const map = std.ComptimeStringMap(Attribute, .{
|
pub const map = std.ComptimeStringMap(Attribute, .{
|
||||||
.{ &[_]u8{ 0x55, 0x04, 0x03 }, .commonName },
|
.{ &[_]u8{ 0x55, 0x04, 0x03 }, .commonName },
|
||||||
@ -70,6 +77,7 @@ pub const Attribute = enum {
|
|||||||
.{ &[_]u8{ 0x55, 0x04, 0x0B }, .organizationalUnitName },
|
.{ &[_]u8{ 0x55, 0x04, 0x0B }, .organizationalUnitName },
|
||||||
.{ &[_]u8{ 0x55, 0x04, 0x61 }, .organizationIdentifier },
|
.{ &[_]u8{ 0x55, 0x04, 0x61 }, .organizationIdentifier },
|
||||||
.{ &[_]u8{ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01 }, .pkcs9_emailAddress },
|
.{ &[_]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 +101,40 @@ pub const ExtensionId = enum {
|
|||||||
crl_number,
|
crl_number,
|
||||||
certificate_policies,
|
certificate_policies,
|
||||||
authority_key_identifier,
|
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, .{
|
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, 0x0E }, .subject_key_identifier },
|
||||||
.{ &[_]u8{ 0x55, 0x1D, 0x0F }, .key_usage },
|
.{ &[_]u8{ 0x55, 0x1D, 0x0F }, .key_usage },
|
||||||
|
.{ &[_]u8{ 0x55, 0x1D, 0x0A }, .basic_constraints },
|
||||||
.{ &[_]u8{ 0x55, 0x1D, 0x10 }, .private_key_usage_period },
|
.{ &[_]u8{ 0x55, 0x1D, 0x10 }, .private_key_usage_period },
|
||||||
.{ &[_]u8{ 0x55, 0x1D, 0x11 }, .subject_alt_name },
|
.{ &[_]u8{ 0x55, 0x1D, 0x11 }, .subject_alt_name },
|
||||||
.{ &[_]u8{ 0x55, 0x1D, 0x12 }, .issuer_alt_name },
|
.{ &[_]u8{ 0x55, 0x1D, 0x12 }, .issuer_alt_name },
|
||||||
.{ &[_]u8{ 0x55, 0x1D, 0x13 }, .basic_constraints },
|
.{ &[_]u8{ 0x55, 0x1D, 0x13 }, .basic_constraints },
|
||||||
.{ &[_]u8{ 0x55, 0x1D, 0x14 }, .crl_number },
|
.{ &[_]u8{ 0x55, 0x1D, 0x14 }, .crl_number },
|
||||||
|
.{ &[_]u8{ 0x55, 0x1D, 0x1F }, .crl_distribution_points },
|
||||||
.{ &[_]u8{ 0x55, 0x1D, 0x20 }, .certificate_policies },
|
.{ &[_]u8{ 0x55, 0x1D, 0x20 }, .certificate_policies },
|
||||||
.{ &[_]u8{ 0x55, 0x1D, 0x23 }, .authority_key_identifier },
|
.{ &[_]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 },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -238,6 +269,10 @@ pub const Parsed = struct {
|
|||||||
parsed_issuer.pub_key_algo,
|
parsed_issuer.pub_key_algo,
|
||||||
parsed_issuer.pubKey(),
|
parsed_issuer.pubKey(),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
.md2WithRSAEncryption, .md5WithRSAEncryption => {
|
||||||
|
return error.CertificateSignatureAlgorithmUnsupported;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user