|
| 1 | +// This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | +// License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | +// file, You can obtain one at https://mozilla.org/MPL/2.0/. |
| 4 | + |
| 5 | +// NOTE: This DER blob, offsets & lengths is mostly generated code. This was |
| 6 | +// accomplished by creating a certificate with the desired structure (including |
| 7 | +// DICE specific extensions and policy) using the openssl ca tools. The fields |
| 8 | +// that we need to operate on were identified and their offsets recorded. The |
| 9 | +// values in these regions (signatureValue, serialNumber, issuer, subject, |
| 10 | +// validity etc) are then removed. |
| 11 | +// |
| 12 | +// TODO: generate cert template DER from ASN.1 & text config |
| 13 | +#[allow(dead_code)] |
| 14 | +pub const SIZE: usize = 608; |
| 15 | +#[allow(dead_code)] |
| 16 | +pub const SERIAL_NUMBER_START: usize = 15; |
| 17 | +#[allow(dead_code)] |
| 18 | +pub const SERIAL_NUMBER_END: usize = 16; |
| 19 | +#[allow(dead_code)] |
| 20 | +pub const ISSUER_SN_START: usize = 169; |
| 21 | +#[allow(dead_code)] |
| 22 | +pub const ISSUER_SN_END: usize = 181; |
| 23 | +#[allow(dead_code)] |
| 24 | +pub const SN_LENGTH: usize = 12; |
| 25 | +#[allow(dead_code)] |
| 26 | +pub const NOTBEFORE_START: usize = 185; |
| 27 | +#[allow(dead_code)] |
| 28 | +pub const NOTBEFORE_END: usize = 198; |
| 29 | +#[allow(dead_code)] |
| 30 | +pub const NOTBEFORE_LENGTH: usize = 13; |
| 31 | +#[allow(dead_code)] |
| 32 | +pub const SUBJECT_SN_START: usize = 357; |
| 33 | +#[allow(dead_code)] |
| 34 | +pub const SUBJECT_SN_END: usize = 369; |
| 35 | +#[allow(dead_code)] |
| 36 | +pub const PUB_START: usize = 381; |
| 37 | +#[allow(dead_code)] |
| 38 | +pub const PUB_END: usize = 413; |
| 39 | +#[allow(dead_code)] |
| 40 | +pub const SIG_START: usize = 544; |
| 41 | +#[allow(dead_code)] |
| 42 | +pub const SIG_END: usize = 608; |
| 43 | +#[allow(dead_code)] |
| 44 | +pub const SIGNDATA_START: usize = 4; |
| 45 | +#[allow(dead_code)] |
| 46 | +pub const SIGNDATA_END: usize = 534; |
| 47 | +#[allow(dead_code)] |
| 48 | +pub const SIGNDATA_LENGTH: usize = 530; |
| 49 | +#[allow(dead_code)] |
| 50 | +pub const FWID_START: usize = 502; |
| 51 | +#[allow(dead_code)] |
| 52 | +pub const FWID_END: usize = 534; |
| 53 | +#[allow(dead_code)] |
| 54 | +pub const FWID_LENGTH: usize = 32; |
| 55 | +pub const CERT_TMPL: [u8; 608] = [ |
| 56 | + 0x30, 0x82, 0x02, 0x5c, 0x30, 0x82, 0x02, 0x0e, 0xa0, 0x03, 0x02, 0x01, |
| 57 | + 0x02, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x30, |
| 58 | + 0x81, 0x9b, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, |
| 59 | + 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, |
| 60 | + 0x0c, 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61, |
| 61 | + 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x0a, 0x45, |
| 62 | + 0x6d, 0x65, 0x72, 0x79, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x31, 0x1f, 0x30, |
| 63 | + 0x1d, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x16, 0x4f, 0x78, 0x69, 0x64, |
| 64 | + 0x65, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x72, 0x20, 0x43, |
| 65 | + 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x31, 0x16, 0x30, 0x14, 0x06, 0x03, |
| 66 | + 0x55, 0x04, 0x0b, 0x0c, 0x0d, 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, |
| 67 | + 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, |
| 68 | + 0x55, 0x04, 0x03, 0x0c, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2d, |
| 69 | + 0x69, 0x64, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x05, 0x13, |
| 70 | + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 71 | + 0x00, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x32, 0x30, 0x37, 0x33, 0x31, 0x31, |
| 72 | + 0x37, 0x30, 0x30, 0x34, 0x34, 0x5a, 0x18, 0x0f, 0x39, 0x39, 0x39, 0x39, |
| 73 | + 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, |
| 74 | + 0x81, 0x97, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, |
| 75 | + 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, |
| 76 | + 0x0c, 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61, |
| 77 | + 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x0a, 0x45, |
| 78 | + 0x6d, 0x65, 0x72, 0x79, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x31, 0x1f, 0x30, |
| 79 | + 0x1d, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x16, 0x4f, 0x78, 0x69, 0x64, |
| 80 | + 0x65, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x72, 0x20, 0x43, |
| 81 | + 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x31, 0x16, 0x30, 0x14, 0x06, 0x03, |
| 82 | + 0x55, 0x04, 0x0b, 0x0c, 0x0d, 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, |
| 83 | + 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x31, 0x0e, 0x30, 0x0c, 0x06, 0x03, |
| 84 | + 0x55, 0x04, 0x03, 0x0c, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x31, 0x15, |
| 85 | + 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x05, 0x13, 0x0c, 0x00, 0x00, 0x00, |
| 86 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2a, 0x30, |
| 87 | + 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x03, 0x21, 0x00, 0x00, 0x00, 0x00, |
| 88 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 89 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 90 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0x77, 0x30, 0x75, 0x30, 0x09, 0x06, |
| 91 | + 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0e, 0x06, 0x03, |
| 92 | + 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x03, 0xa8, |
| 93 | + 0x30, 0x17, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x01, 0x01, 0xff, 0x04, 0x0d, |
| 94 | + 0x30, 0x0b, 0x30, 0x09, 0x06, 0x07, 0x67, 0x81, 0x05, 0x05, 0x04, 0x64, |
| 95 | + 0x08, 0x30, 0x3f, 0x06, 0x05, 0x67, 0x81, 0x05, 0x05, 0x04, 0x01, 0x01, |
| 96 | + 0xff, 0x04, 0x33, 0x30, 0x31, 0xa6, 0x2f, 0x30, 0x2d, 0x06, 0x09, 0x60, |
| 97 | + 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x08, 0x04, 0x20, 0x00, 0x00, |
| 98 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 99 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 100 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, |
| 101 | + 0x70, 0x03, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 102 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 103 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 104 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 105 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 106 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 107 | +]; |
0 commit comments