| author | |
| committer | |
| log | 5ab3a21e390384672bc58171c9985d2d1d11b46e |
| tree | 560ef2f68bcff76b6b0ba9d73ff1b878aac91fff |
| parent | f6deade4e0033031d2161049dc62ab94c27209f4 |
Make sure the asn1 code compiles and runs.2 files changed, 15 insertions(+), 0 deletions(-)
lib/std/crypto/codecs.zig+6| ... | ... | @@ -1,3 +1,9 @@ |
| 1 | 1 | pub const asn1 = @import("codecs/asn1.zig"); |
| 2 | 2 | pub const base64 = @import("codecs/base64_hex_ct.zig").base64; |
| 3 | 3 | pub const hex = @import("codecs/base64_hex_ct.zig").hex; |
| 4 | ||
| 5 | test { | |
| 6 | _ = asn1; | |
| 7 | _ = base64; | |
| 8 | _ = hex; | |
| 9 | } |
lib/std/crypto/codecs/asn1.zig+9| ... | ... | @@ -366,6 +366,15 @@ pub const BitString = struct { |
| 366 | 366 | } |
| 367 | 367 | }; |
| 368 | 368 | |
| 369 | test BitString { | |
| 370 | const bs = BitString{ .bytes = &.{ 0x6e, 0x5d, 0xc0 }, .right_padding = 6 }; | |
| 371 | const allocator = std.testing.allocator; | |
| 372 | const buf = try der.encode(allocator, bs); | |
| 373 | defer allocator.free(buf); | |
| 374 | try std.testing.expectEqualSlices(u8, &.{ 0x03, 0x04, 0x06, 0x6e, 0x5d, 0xc0 }, buf); | |
| 375 | try std.testing.expectEqualDeep(bs, try der.decode(BitString, buf)); | |
| 376 | } | |
| 377 | ||
| 369 | 378 | pub fn Opaque(comptime tag: Tag) type { |
| 370 | 379 | return struct { |
| 371 | 380 | bytes: []const u8, |