Skip to main content

kc/
apple_schema.rs

1//! Apple's keychain schema, as data.
2//!
3//! GENERATED by `xtask/extract-schema.py` from a keychain written by
4//! `security create-keychain`. Do not edit by hand; re-run the script against a
5//! newer macOS if its schema ever changes.
6//!
7//! `kc create` replays these rows and index blobs so that a keychain it writes
8//! carries the schema macOS expects. `tests/keychain_container.rs` and
9//! `tests/keychain_interop.rs` check the result against a keychain `security`
10//! created.
11
12/// One row of `CSSM_DL_DB_SCHEMA_INFO`.
13pub struct RelationRow {
14    pub relation_id: u32,
15    pub name: Option<&'static [u8]>,
16}
17
18/// One row of `CSSM_DL_DB_SCHEMA_ATTRIBUTES`.
19pub struct AttributeRow {
20    pub relation_id: u32,
21    pub attribute_id: u32,
22    pub name_format: u32,
23    pub name: Option<&'static [u8]>,
24    pub name_id: Option<&'static [u8]>,
25    pub format: u32,
26}
27
28/// One row of `CSSM_DL_DB_SCHEMA_INDEXES`.
29pub struct IndexRow {
30    pub relation_id: u32,
31    pub index_id: u32,
32    pub attribute_id: u32,
33    pub index_type: u32,
34    pub indexed_data_location: u32,
35}
36
37/// A table as macOS first writes it: its relation, the free-list field it sets
38/// while the table is empty, and the index blob that declares its indexes.
39pub struct TableTemplate {
40    pub relation_id: u32,
41    pub free_list: u32,
42    pub index_data: &'static [u8],
43}
44
45/// Record header version field that macOS writes for every record.
46pub const RECORD_VERSION: u32 = 1;
47
48/// Relations, in the order macOS writes them.
49pub const RELATIONS: [RelationRow; 11] = [
50    RelationRow {
51        relation_id: 0x00000000,
52        name: Some(b"CSSM_DL_DB_SCHEMA_INFO"),
53    },
54    RelationRow {
55        relation_id: 0x00000002,
56        name: Some(b"CSSM_DL_DB_SCHEMA_ATTRIBUTES"),
57    },
58    RelationRow {
59        relation_id: 0x00000001,
60        name: Some(b"CSSM_DL_DB_SCHEMA_INDEXES"),
61    },
62    RelationRow {
63        relation_id: 0x00000003,
64        name: Some(b"CSSM_DL_DB_SCHEMA_PARSING_MODULE"),
65    },
66    RelationRow {
67        relation_id: 0x80000000,
68        name: Some(b""),
69    },
70    RelationRow {
71        relation_id: 0x80000002,
72        name: Some(b""),
73    },
74    RelationRow {
75        relation_id: 0x80000001,
76        name: Some(b""),
77    },
78    RelationRow {
79        relation_id: 0x80008000,
80        name: Some(b"DBBlob"),
81    },
82    RelationRow {
83        relation_id: 0x0000000f,
84        name: Some(b"CSSM_DL_DB_RECORD_PUBLIC_KEY"),
85    },
86    RelationRow {
87        relation_id: 0x00000010,
88        name: Some(b"CSSM_DL_DB_RECORD_PRIVATE_KEY"),
89    },
90    RelationRow {
91        relation_id: 0x00000011,
92        name: Some(b"CSSM_DL_DB_RECORD_SYMMETRIC_KEY"),
93    },
94];
95
96pub const ATTRIBUTES: [AttributeRow; 155] = [
97    AttributeRow {
98        relation_id: 0x00000000,
99        attribute_id: 0x00000000,
100        name_format: 0,
101        name: Some(b"RelationID"),
102        name_id: None,
103        format: 2,
104    },
105    AttributeRow {
106        relation_id: 0x00000000,
107        attribute_id: 0x00000001,
108        name_format: 0,
109        name: Some(b"RelationName"),
110        name_id: None,
111        format: 0,
112    },
113    AttributeRow {
114        relation_id: 0x00000002,
115        attribute_id: 0x00000000,
116        name_format: 0,
117        name: Some(b"RelationID"),
118        name_id: None,
119        format: 2,
120    },
121    AttributeRow {
122        relation_id: 0x00000002,
123        attribute_id: 0x00000001,
124        name_format: 0,
125        name: Some(b"AttributeID"),
126        name_id: None,
127        format: 2,
128    },
129    AttributeRow {
130        relation_id: 0x00000002,
131        attribute_id: 0x00000002,
132        name_format: 0,
133        name: Some(b"AttributeNameFormat"),
134        name_id: None,
135        format: 2,
136    },
137    AttributeRow {
138        relation_id: 0x00000002,
139        attribute_id: 0x00000003,
140        name_format: 0,
141        name: Some(b"AttributeName"),
142        name_id: None,
143        format: 0,
144    },
145    AttributeRow {
146        relation_id: 0x00000002,
147        attribute_id: 0x00000004,
148        name_format: 0,
149        name: Some(b"AttributeNameID"),
150        name_id: None,
151        format: 6,
152    },
153    AttributeRow {
154        relation_id: 0x00000002,
155        attribute_id: 0x00000005,
156        name_format: 0,
157        name: Some(b"AttributeFormat"),
158        name_id: None,
159        format: 2,
160    },
161    AttributeRow {
162        relation_id: 0x00000001,
163        attribute_id: 0x00000000,
164        name_format: 0,
165        name: Some(b"RelationID"),
166        name_id: None,
167        format: 2,
168    },
169    AttributeRow {
170        relation_id: 0x00000001,
171        attribute_id: 0x00000001,
172        name_format: 0,
173        name: Some(b"IndexID"),
174        name_id: None,
175        format: 2,
176    },
177    AttributeRow {
178        relation_id: 0x00000001,
179        attribute_id: 0x00000002,
180        name_format: 0,
181        name: Some(b"AttributeID"),
182        name_id: None,
183        format: 2,
184    },
185    AttributeRow {
186        relation_id: 0x00000001,
187        attribute_id: 0x00000003,
188        name_format: 0,
189        name: Some(b"IndexType"),
190        name_id: None,
191        format: 2,
192    },
193    AttributeRow {
194        relation_id: 0x00000001,
195        attribute_id: 0x00000004,
196        name_format: 0,
197        name: Some(b"IndexedDataLocation"),
198        name_id: None,
199        format: 2,
200    },
201    AttributeRow {
202        relation_id: 0x00000003,
203        attribute_id: 0x00000000,
204        name_format: 0,
205        name: Some(b"RelationID"),
206        name_id: None,
207        format: 2,
208    },
209    AttributeRow {
210        relation_id: 0x00000003,
211        attribute_id: 0x00000001,
212        name_format: 0,
213        name: Some(b"AttributeID"),
214        name_id: None,
215        format: 2,
216    },
217    AttributeRow {
218        relation_id: 0x00000003,
219        attribute_id: 0x00000002,
220        name_format: 0,
221        name: Some(b"ModuleID"),
222        name_id: None,
223        format: 6,
224    },
225    AttributeRow {
226        relation_id: 0x00000003,
227        attribute_id: 0x00000003,
228        name_format: 0,
229        name: Some(b"AddinVersion"),
230        name_id: None,
231        format: 0,
232    },
233    AttributeRow {
234        relation_id: 0x00000003,
235        attribute_id: 0x00000004,
236        name_format: 0,
237        name: Some(b"SSID"),
238        name_id: None,
239        format: 2,
240    },
241    AttributeRow {
242        relation_id: 0x00000003,
243        attribute_id: 0x00000005,
244        name_format: 0,
245        name: Some(b"SubserviceType"),
246        name_id: None,
247        format: 2,
248    },
249    AttributeRow {
250        relation_id: 0x80000000,
251        attribute_id: 0x63646174,
252        name_format: 2,
253        name: None,
254        name_id: None,
255        format: 5,
256    },
257    AttributeRow {
258        relation_id: 0x80000000,
259        attribute_id: 0x6d646174,
260        name_format: 2,
261        name: None,
262        name_id: None,
263        format: 5,
264    },
265    AttributeRow {
266        relation_id: 0x80000000,
267        attribute_id: 0x64657363,
268        name_format: 2,
269        name: None,
270        name_id: None,
271        format: 6,
272    },
273    AttributeRow {
274        relation_id: 0x80000000,
275        attribute_id: 0x69636d74,
276        name_format: 2,
277        name: None,
278        name_id: None,
279        format: 6,
280    },
281    AttributeRow {
282        relation_id: 0x80000000,
283        attribute_id: 0x63727472,
284        name_format: 2,
285        name: None,
286        name_id: None,
287        format: 2,
288    },
289    AttributeRow {
290        relation_id: 0x80000000,
291        attribute_id: 0x74797065,
292        name_format: 2,
293        name: None,
294        name_id: None,
295        format: 2,
296    },
297    AttributeRow {
298        relation_id: 0x80000000,
299        attribute_id: 0x73637270,
300        name_format: 2,
301        name: None,
302        name_id: None,
303        format: 1,
304    },
305    AttributeRow {
306        relation_id: 0x80000000,
307        attribute_id: 0x00000007,
308        name_format: 0,
309        name: Some(b"PrintName"),
310        name_id: None,
311        format: 6,
312    },
313    AttributeRow {
314        relation_id: 0x80000000,
315        attribute_id: 0x00000008,
316        name_format: 0,
317        name: Some(b"Alias"),
318        name_id: None,
319        format: 6,
320    },
321    AttributeRow {
322        relation_id: 0x80000000,
323        attribute_id: 0x696e7669,
324        name_format: 2,
325        name: None,
326        name_id: None,
327        format: 1,
328    },
329    AttributeRow {
330        relation_id: 0x80000000,
331        attribute_id: 0x6e656761,
332        name_format: 2,
333        name: None,
334        name_id: None,
335        format: 1,
336    },
337    AttributeRow {
338        relation_id: 0x80000000,
339        attribute_id: 0x63757369,
340        name_format: 2,
341        name: None,
342        name_id: None,
343        format: 1,
344    },
345    AttributeRow {
346        relation_id: 0x80000000,
347        attribute_id: 0x70726f74,
348        name_format: 2,
349        name: None,
350        name_id: None,
351        format: 6,
352    },
353    AttributeRow {
354        relation_id: 0x80000000,
355        attribute_id: 0x61636374,
356        name_format: 2,
357        name: None,
358        name_id: None,
359        format: 6,
360    },
361    AttributeRow {
362        relation_id: 0x80000000,
363        attribute_id: 0x73766365,
364        name_format: 2,
365        name: None,
366        name_id: None,
367        format: 6,
368    },
369    AttributeRow {
370        relation_id: 0x80000000,
371        attribute_id: 0x67656e61,
372        name_format: 2,
373        name: None,
374        name_id: None,
375        format: 6,
376    },
377    AttributeRow {
378        relation_id: 0x80000002,
379        attribute_id: 0x63646174,
380        name_format: 2,
381        name: None,
382        name_id: None,
383        format: 5,
384    },
385    AttributeRow {
386        relation_id: 0x80000002,
387        attribute_id: 0x6d646174,
388        name_format: 2,
389        name: None,
390        name_id: None,
391        format: 5,
392    },
393    AttributeRow {
394        relation_id: 0x80000002,
395        attribute_id: 0x64657363,
396        name_format: 2,
397        name: None,
398        name_id: None,
399        format: 6,
400    },
401    AttributeRow {
402        relation_id: 0x80000002,
403        attribute_id: 0x69636d74,
404        name_format: 2,
405        name: None,
406        name_id: None,
407        format: 6,
408    },
409    AttributeRow {
410        relation_id: 0x80000002,
411        attribute_id: 0x63727472,
412        name_format: 2,
413        name: None,
414        name_id: None,
415        format: 2,
416    },
417    AttributeRow {
418        relation_id: 0x80000002,
419        attribute_id: 0x74797065,
420        name_format: 2,
421        name: None,
422        name_id: None,
423        format: 2,
424    },
425    AttributeRow {
426        relation_id: 0x80000002,
427        attribute_id: 0x73637270,
428        name_format: 2,
429        name: None,
430        name_id: None,
431        format: 1,
432    },
433    AttributeRow {
434        relation_id: 0x80000002,
435        attribute_id: 0x00000007,
436        name_format: 0,
437        name: Some(b"PrintName"),
438        name_id: None,
439        format: 6,
440    },
441    AttributeRow {
442        relation_id: 0x80000002,
443        attribute_id: 0x00000008,
444        name_format: 0,
445        name: Some(b"Alias"),
446        name_id: None,
447        format: 6,
448    },
449    AttributeRow {
450        relation_id: 0x80000002,
451        attribute_id: 0x696e7669,
452        name_format: 2,
453        name: None,
454        name_id: None,
455        format: 1,
456    },
457    AttributeRow {
458        relation_id: 0x80000002,
459        attribute_id: 0x6e656761,
460        name_format: 2,
461        name: None,
462        name_id: None,
463        format: 1,
464    },
465    AttributeRow {
466        relation_id: 0x80000002,
467        attribute_id: 0x63757369,
468        name_format: 2,
469        name: None,
470        name_id: None,
471        format: 1,
472    },
473    AttributeRow {
474        relation_id: 0x80000002,
475        attribute_id: 0x70726f74,
476        name_format: 2,
477        name: None,
478        name_id: None,
479        format: 6,
480    },
481    AttributeRow {
482        relation_id: 0x80000002,
483        attribute_id: 0x61636374,
484        name_format: 2,
485        name: None,
486        name_id: None,
487        format: 6,
488    },
489    AttributeRow {
490        relation_id: 0x80000002,
491        attribute_id: 0x766c6d65,
492        name_format: 2,
493        name: None,
494        name_id: None,
495        format: 6,
496    },
497    AttributeRow {
498        relation_id: 0x80000002,
499        attribute_id: 0x73727672,
500        name_format: 2,
501        name: None,
502        name_id: None,
503        format: 6,
504    },
505    AttributeRow {
506        relation_id: 0x80000002,
507        attribute_id: 0x7074636c,
508        name_format: 2,
509        name: None,
510        name_id: None,
511        format: 2,
512    },
513    AttributeRow {
514        relation_id: 0x80000002,
515        attribute_id: 0x61646472,
516        name_format: 2,
517        name: None,
518        name_id: None,
519        format: 6,
520    },
521    AttributeRow {
522        relation_id: 0x80000002,
523        attribute_id: 0x73736967,
524        name_format: 2,
525        name: None,
526        name_id: None,
527        format: 6,
528    },
529    AttributeRow {
530        relation_id: 0x80000001,
531        attribute_id: 0x63646174,
532        name_format: 2,
533        name: None,
534        name_id: None,
535        format: 5,
536    },
537    AttributeRow {
538        relation_id: 0x80000001,
539        attribute_id: 0x6d646174,
540        name_format: 2,
541        name: None,
542        name_id: None,
543        format: 5,
544    },
545    AttributeRow {
546        relation_id: 0x80000001,
547        attribute_id: 0x64657363,
548        name_format: 2,
549        name: None,
550        name_id: None,
551        format: 6,
552    },
553    AttributeRow {
554        relation_id: 0x80000001,
555        attribute_id: 0x69636d74,
556        name_format: 2,
557        name: None,
558        name_id: None,
559        format: 6,
560    },
561    AttributeRow {
562        relation_id: 0x80000001,
563        attribute_id: 0x63727472,
564        name_format: 2,
565        name: None,
566        name_id: None,
567        format: 2,
568    },
569    AttributeRow {
570        relation_id: 0x80000001,
571        attribute_id: 0x74797065,
572        name_format: 2,
573        name: None,
574        name_id: None,
575        format: 2,
576    },
577    AttributeRow {
578        relation_id: 0x80000001,
579        attribute_id: 0x73637270,
580        name_format: 2,
581        name: None,
582        name_id: None,
583        format: 1,
584    },
585    AttributeRow {
586        relation_id: 0x80000001,
587        attribute_id: 0x00000007,
588        name_format: 0,
589        name: Some(b"PrintName"),
590        name_id: None,
591        format: 6,
592    },
593    AttributeRow {
594        relation_id: 0x80000001,
595        attribute_id: 0x00000008,
596        name_format: 0,
597        name: Some(b"Alias"),
598        name_id: None,
599        format: 6,
600    },
601    AttributeRow {
602        relation_id: 0x80000001,
603        attribute_id: 0x696e7669,
604        name_format: 2,
605        name: None,
606        name_id: None,
607        format: 1,
608    },
609    AttributeRow {
610        relation_id: 0x80000001,
611        attribute_id: 0x6e656761,
612        name_format: 2,
613        name: None,
614        name_id: None,
615        format: 1,
616    },
617    AttributeRow {
618        relation_id: 0x80000001,
619        attribute_id: 0x63757369,
620        name_format: 2,
621        name: None,
622        name_id: None,
623        format: 1,
624    },
625    AttributeRow {
626        relation_id: 0x80000001,
627        attribute_id: 0x70726f74,
628        name_format: 2,
629        name: None,
630        name_id: None,
631        format: 6,
632    },
633    AttributeRow {
634        relation_id: 0x80000001,
635        attribute_id: 0x61636374,
636        name_format: 2,
637        name: None,
638        name_id: None,
639        format: 6,
640    },
641    AttributeRow {
642        relation_id: 0x80000001,
643        attribute_id: 0x73646d6e,
644        name_format: 2,
645        name: None,
646        name_id: None,
647        format: 6,
648    },
649    AttributeRow {
650        relation_id: 0x80000001,
651        attribute_id: 0x73727672,
652        name_format: 2,
653        name: None,
654        name_id: None,
655        format: 6,
656    },
657    AttributeRow {
658        relation_id: 0x80000001,
659        attribute_id: 0x7074636c,
660        name_format: 2,
661        name: None,
662        name_id: None,
663        format: 2,
664    },
665    AttributeRow {
666        relation_id: 0x80000001,
667        attribute_id: 0x61747970,
668        name_format: 2,
669        name: None,
670        name_id: None,
671        format: 6,
672    },
673    AttributeRow {
674        relation_id: 0x80000001,
675        attribute_id: 0x706f7274,
676        name_format: 2,
677        name: None,
678        name_id: None,
679        format: 2,
680    },
681    AttributeRow {
682        relation_id: 0x80000001,
683        attribute_id: 0x70617468,
684        name_format: 2,
685        name: None,
686        name_id: None,
687        format: 6,
688    },
689    AttributeRow {
690        relation_id: 0x0000000f,
691        attribute_id: 0x00000000,
692        name_format: 2,
693        name: Some(b"KeyClass"),
694        name_id: None,
695        format: 2,
696    },
697    AttributeRow {
698        relation_id: 0x0000000f,
699        attribute_id: 0x00000001,
700        name_format: 2,
701        name: Some(b"PrintName"),
702        name_id: None,
703        format: 6,
704    },
705    AttributeRow {
706        relation_id: 0x0000000f,
707        attribute_id: 0x00000002,
708        name_format: 2,
709        name: Some(b"Alias"),
710        name_id: None,
711        format: 6,
712    },
713    AttributeRow {
714        relation_id: 0x0000000f,
715        attribute_id: 0x00000003,
716        name_format: 2,
717        name: Some(b"Permanent"),
718        name_id: None,
719        format: 2,
720    },
721    AttributeRow {
722        relation_id: 0x0000000f,
723        attribute_id: 0x00000004,
724        name_format: 2,
725        name: Some(b"Private"),
726        name_id: None,
727        format: 2,
728    },
729    AttributeRow {
730        relation_id: 0x0000000f,
731        attribute_id: 0x00000005,
732        name_format: 2,
733        name: Some(b"Modifiable"),
734        name_id: None,
735        format: 2,
736    },
737    AttributeRow {
738        relation_id: 0x0000000f,
739        attribute_id: 0x00000006,
740        name_format: 2,
741        name: Some(b"Label"),
742        name_id: None,
743        format: 6,
744    },
745    AttributeRow {
746        relation_id: 0x0000000f,
747        attribute_id: 0x00000007,
748        name_format: 2,
749        name: Some(b"ApplicationTag"),
750        name_id: None,
751        format: 6,
752    },
753    AttributeRow {
754        relation_id: 0x0000000f,
755        attribute_id: 0x00000008,
756        name_format: 2,
757        name: Some(b"KeyCreator"),
758        name_id: None,
759        format: 6,
760    },
761    AttributeRow {
762        relation_id: 0x0000000f,
763        attribute_id: 0x00000009,
764        name_format: 2,
765        name: Some(b"KeyType"),
766        name_id: None,
767        format: 2,
768    },
769    AttributeRow {
770        relation_id: 0x0000000f,
771        attribute_id: 0x0000000a,
772        name_format: 2,
773        name: Some(b"KeySizeInBits"),
774        name_id: None,
775        format: 2,
776    },
777    AttributeRow {
778        relation_id: 0x0000000f,
779        attribute_id: 0x0000000b,
780        name_format: 2,
781        name: Some(b"EffectiveKeySize"),
782        name_id: None,
783        format: 2,
784    },
785    AttributeRow {
786        relation_id: 0x0000000f,
787        attribute_id: 0x0000000c,
788        name_format: 2,
789        name: Some(b"StartDate"),
790        name_id: None,
791        format: 6,
792    },
793    AttributeRow {
794        relation_id: 0x0000000f,
795        attribute_id: 0x0000000d,
796        name_format: 2,
797        name: Some(b"EndDate"),
798        name_id: None,
799        format: 6,
800    },
801    AttributeRow {
802        relation_id: 0x0000000f,
803        attribute_id: 0x0000000e,
804        name_format: 2,
805        name: Some(b"Sensitive"),
806        name_id: None,
807        format: 2,
808    },
809    AttributeRow {
810        relation_id: 0x0000000f,
811        attribute_id: 0x0000000f,
812        name_format: 2,
813        name: Some(b"AlwaysSensitive"),
814        name_id: None,
815        format: 2,
816    },
817    AttributeRow {
818        relation_id: 0x0000000f,
819        attribute_id: 0x00000010,
820        name_format: 2,
821        name: Some(b"Extractable"),
822        name_id: None,
823        format: 2,
824    },
825    AttributeRow {
826        relation_id: 0x0000000f,
827        attribute_id: 0x00000011,
828        name_format: 2,
829        name: Some(b"NeverExtractable"),
830        name_id: None,
831        format: 2,
832    },
833    AttributeRow {
834        relation_id: 0x0000000f,
835        attribute_id: 0x00000012,
836        name_format: 2,
837        name: Some(b"Encrypt"),
838        name_id: None,
839        format: 2,
840    },
841    AttributeRow {
842        relation_id: 0x0000000f,
843        attribute_id: 0x00000013,
844        name_format: 2,
845        name: Some(b"Decrypt"),
846        name_id: None,
847        format: 2,
848    },
849    AttributeRow {
850        relation_id: 0x0000000f,
851        attribute_id: 0x00000014,
852        name_format: 2,
853        name: Some(b"Derive"),
854        name_id: None,
855        format: 2,
856    },
857    AttributeRow {
858        relation_id: 0x0000000f,
859        attribute_id: 0x00000015,
860        name_format: 2,
861        name: Some(b"Sign"),
862        name_id: None,
863        format: 2,
864    },
865    AttributeRow {
866        relation_id: 0x0000000f,
867        attribute_id: 0x00000016,
868        name_format: 2,
869        name: Some(b"Verify"),
870        name_id: None,
871        format: 2,
872    },
873    AttributeRow {
874        relation_id: 0x0000000f,
875        attribute_id: 0x00000017,
876        name_format: 2,
877        name: Some(b"SignRecover"),
878        name_id: None,
879        format: 2,
880    },
881    AttributeRow {
882        relation_id: 0x0000000f,
883        attribute_id: 0x00000018,
884        name_format: 2,
885        name: Some(b"VerifyRecover"),
886        name_id: None,
887        format: 2,
888    },
889    AttributeRow {
890        relation_id: 0x0000000f,
891        attribute_id: 0x00000019,
892        name_format: 2,
893        name: Some(b"Wrap"),
894        name_id: None,
895        format: 2,
896    },
897    AttributeRow {
898        relation_id: 0x0000000f,
899        attribute_id: 0x0000001a,
900        name_format: 2,
901        name: Some(b"Unwrap"),
902        name_id: None,
903        format: 2,
904    },
905    AttributeRow {
906        relation_id: 0x00000010,
907        attribute_id: 0x00000000,
908        name_format: 2,
909        name: Some(b"KeyClass"),
910        name_id: None,
911        format: 2,
912    },
913    AttributeRow {
914        relation_id: 0x00000010,
915        attribute_id: 0x00000001,
916        name_format: 2,
917        name: Some(b"PrintName"),
918        name_id: None,
919        format: 6,
920    },
921    AttributeRow {
922        relation_id: 0x00000010,
923        attribute_id: 0x00000002,
924        name_format: 2,
925        name: Some(b"Alias"),
926        name_id: None,
927        format: 6,
928    },
929    AttributeRow {
930        relation_id: 0x00000010,
931        attribute_id: 0x00000003,
932        name_format: 2,
933        name: Some(b"Permanent"),
934        name_id: None,
935        format: 2,
936    },
937    AttributeRow {
938        relation_id: 0x00000010,
939        attribute_id: 0x00000004,
940        name_format: 2,
941        name: Some(b"Private"),
942        name_id: None,
943        format: 2,
944    },
945    AttributeRow {
946        relation_id: 0x00000010,
947        attribute_id: 0x00000005,
948        name_format: 2,
949        name: Some(b"Modifiable"),
950        name_id: None,
951        format: 2,
952    },
953    AttributeRow {
954        relation_id: 0x00000010,
955        attribute_id: 0x00000006,
956        name_format: 2,
957        name: Some(b"Label"),
958        name_id: None,
959        format: 6,
960    },
961    AttributeRow {
962        relation_id: 0x00000010,
963        attribute_id: 0x00000007,
964        name_format: 2,
965        name: Some(b"ApplicationTag"),
966        name_id: None,
967        format: 6,
968    },
969    AttributeRow {
970        relation_id: 0x00000010,
971        attribute_id: 0x00000008,
972        name_format: 2,
973        name: Some(b"KeyCreator"),
974        name_id: None,
975        format: 6,
976    },
977    AttributeRow {
978        relation_id: 0x00000010,
979        attribute_id: 0x00000009,
980        name_format: 2,
981        name: Some(b"KeyType"),
982        name_id: None,
983        format: 2,
984    },
985    AttributeRow {
986        relation_id: 0x00000010,
987        attribute_id: 0x0000000a,
988        name_format: 2,
989        name: Some(b"KeySizeInBits"),
990        name_id: None,
991        format: 2,
992    },
993    AttributeRow {
994        relation_id: 0x00000010,
995        attribute_id: 0x0000000b,
996        name_format: 2,
997        name: Some(b"EffectiveKeySize"),
998        name_id: None,
999        format: 2,
1000    },
1001    AttributeRow {
1002        relation_id: 0x00000010,
1003        attribute_id: 0x0000000c,
1004        name_format: 2,
1005        name: Some(b"StartDate"),
1006        name_id: None,
1007        format: 6,
1008    },
1009    AttributeRow {
1010        relation_id: 0x00000010,
1011        attribute_id: 0x0000000d,
1012        name_format: 2,
1013        name: Some(b"EndDate"),
1014        name_id: None,
1015        format: 6,
1016    },
1017    AttributeRow {
1018        relation_id: 0x00000010,
1019        attribute_id: 0x0000000e,
1020        name_format: 2,
1021        name: Some(b"Sensitive"),
1022        name_id: None,
1023        format: 2,
1024    },
1025    AttributeRow {
1026        relation_id: 0x00000010,
1027        attribute_id: 0x0000000f,
1028        name_format: 2,
1029        name: Some(b"AlwaysSensitive"),
1030        name_id: None,
1031        format: 2,
1032    },
1033    AttributeRow {
1034        relation_id: 0x00000010,
1035        attribute_id: 0x00000010,
1036        name_format: 2,
1037        name: Some(b"Extractable"),
1038        name_id: None,
1039        format: 2,
1040    },
1041    AttributeRow {
1042        relation_id: 0x00000010,
1043        attribute_id: 0x00000011,
1044        name_format: 2,
1045        name: Some(b"NeverExtractable"),
1046        name_id: None,
1047        format: 2,
1048    },
1049    AttributeRow {
1050        relation_id: 0x00000010,
1051        attribute_id: 0x00000012,
1052        name_format: 2,
1053        name: Some(b"Encrypt"),
1054        name_id: None,
1055        format: 2,
1056    },
1057    AttributeRow {
1058        relation_id: 0x00000010,
1059        attribute_id: 0x00000013,
1060        name_format: 2,
1061        name: Some(b"Decrypt"),
1062        name_id: None,
1063        format: 2,
1064    },
1065    AttributeRow {
1066        relation_id: 0x00000010,
1067        attribute_id: 0x00000014,
1068        name_format: 2,
1069        name: Some(b"Derive"),
1070        name_id: None,
1071        format: 2,
1072    },
1073    AttributeRow {
1074        relation_id: 0x00000010,
1075        attribute_id: 0x00000015,
1076        name_format: 2,
1077        name: Some(b"Sign"),
1078        name_id: None,
1079        format: 2,
1080    },
1081    AttributeRow {
1082        relation_id: 0x00000010,
1083        attribute_id: 0x00000016,
1084        name_format: 2,
1085        name: Some(b"Verify"),
1086        name_id: None,
1087        format: 2,
1088    },
1089    AttributeRow {
1090        relation_id: 0x00000010,
1091        attribute_id: 0x00000017,
1092        name_format: 2,
1093        name: Some(b"SignRecover"),
1094        name_id: None,
1095        format: 2,
1096    },
1097    AttributeRow {
1098        relation_id: 0x00000010,
1099        attribute_id: 0x00000018,
1100        name_format: 2,
1101        name: Some(b"VerifyRecover"),
1102        name_id: None,
1103        format: 2,
1104    },
1105    AttributeRow {
1106        relation_id: 0x00000010,
1107        attribute_id: 0x00000019,
1108        name_format: 2,
1109        name: Some(b"Wrap"),
1110        name_id: None,
1111        format: 2,
1112    },
1113    AttributeRow {
1114        relation_id: 0x00000010,
1115        attribute_id: 0x0000001a,
1116        name_format: 2,
1117        name: Some(b"Unwrap"),
1118        name_id: None,
1119        format: 2,
1120    },
1121    AttributeRow {
1122        relation_id: 0x00000011,
1123        attribute_id: 0x00000000,
1124        name_format: 2,
1125        name: Some(b"KeyClass"),
1126        name_id: None,
1127        format: 2,
1128    },
1129    AttributeRow {
1130        relation_id: 0x00000011,
1131        attribute_id: 0x00000001,
1132        name_format: 2,
1133        name: Some(b"PrintName"),
1134        name_id: None,
1135        format: 6,
1136    },
1137    AttributeRow {
1138        relation_id: 0x00000011,
1139        attribute_id: 0x00000002,
1140        name_format: 2,
1141        name: Some(b"Alias"),
1142        name_id: None,
1143        format: 6,
1144    },
1145    AttributeRow {
1146        relation_id: 0x00000011,
1147        attribute_id: 0x00000003,
1148        name_format: 2,
1149        name: Some(b"Permanent"),
1150        name_id: None,
1151        format: 2,
1152    },
1153    AttributeRow {
1154        relation_id: 0x00000011,
1155        attribute_id: 0x00000004,
1156        name_format: 2,
1157        name: Some(b"Private"),
1158        name_id: None,
1159        format: 2,
1160    },
1161    AttributeRow {
1162        relation_id: 0x00000011,
1163        attribute_id: 0x00000005,
1164        name_format: 2,
1165        name: Some(b"Modifiable"),
1166        name_id: None,
1167        format: 2,
1168    },
1169    AttributeRow {
1170        relation_id: 0x00000011,
1171        attribute_id: 0x00000006,
1172        name_format: 2,
1173        name: Some(b"Label"),
1174        name_id: None,
1175        format: 6,
1176    },
1177    AttributeRow {
1178        relation_id: 0x00000011,
1179        attribute_id: 0x00000007,
1180        name_format: 2,
1181        name: Some(b"ApplicationTag"),
1182        name_id: None,
1183        format: 6,
1184    },
1185    AttributeRow {
1186        relation_id: 0x00000011,
1187        attribute_id: 0x00000008,
1188        name_format: 2,
1189        name: Some(b"KeyCreator"),
1190        name_id: None,
1191        format: 6,
1192    },
1193    AttributeRow {
1194        relation_id: 0x00000011,
1195        attribute_id: 0x00000009,
1196        name_format: 2,
1197        name: Some(b"KeyType"),
1198        name_id: None,
1199        format: 2,
1200    },
1201    AttributeRow {
1202        relation_id: 0x00000011,
1203        attribute_id: 0x0000000a,
1204        name_format: 2,
1205        name: Some(b"KeySizeInBits"),
1206        name_id: None,
1207        format: 2,
1208    },
1209    AttributeRow {
1210        relation_id: 0x00000011,
1211        attribute_id: 0x0000000b,
1212        name_format: 2,
1213        name: Some(b"EffectiveKeySize"),
1214        name_id: None,
1215        format: 2,
1216    },
1217    AttributeRow {
1218        relation_id: 0x00000011,
1219        attribute_id: 0x0000000c,
1220        name_format: 2,
1221        name: Some(b"StartDate"),
1222        name_id: None,
1223        format: 6,
1224    },
1225    AttributeRow {
1226        relation_id: 0x00000011,
1227        attribute_id: 0x0000000d,
1228        name_format: 2,
1229        name: Some(b"EndDate"),
1230        name_id: None,
1231        format: 6,
1232    },
1233    AttributeRow {
1234        relation_id: 0x00000011,
1235        attribute_id: 0x0000000e,
1236        name_format: 2,
1237        name: Some(b"Sensitive"),
1238        name_id: None,
1239        format: 2,
1240    },
1241    AttributeRow {
1242        relation_id: 0x00000011,
1243        attribute_id: 0x0000000f,
1244        name_format: 2,
1245        name: Some(b"AlwaysSensitive"),
1246        name_id: None,
1247        format: 2,
1248    },
1249    AttributeRow {
1250        relation_id: 0x00000011,
1251        attribute_id: 0x00000010,
1252        name_format: 2,
1253        name: Some(b"Extractable"),
1254        name_id: None,
1255        format: 2,
1256    },
1257    AttributeRow {
1258        relation_id: 0x00000011,
1259        attribute_id: 0x00000011,
1260        name_format: 2,
1261        name: Some(b"NeverExtractable"),
1262        name_id: None,
1263        format: 2,
1264    },
1265    AttributeRow {
1266        relation_id: 0x00000011,
1267        attribute_id: 0x00000012,
1268        name_format: 2,
1269        name: Some(b"Encrypt"),
1270        name_id: None,
1271        format: 2,
1272    },
1273    AttributeRow {
1274        relation_id: 0x00000011,
1275        attribute_id: 0x00000013,
1276        name_format: 2,
1277        name: Some(b"Decrypt"),
1278        name_id: None,
1279        format: 2,
1280    },
1281    AttributeRow {
1282        relation_id: 0x00000011,
1283        attribute_id: 0x00000014,
1284        name_format: 2,
1285        name: Some(b"Derive"),
1286        name_id: None,
1287        format: 2,
1288    },
1289    AttributeRow {
1290        relation_id: 0x00000011,
1291        attribute_id: 0x00000015,
1292        name_format: 2,
1293        name: Some(b"Sign"),
1294        name_id: None,
1295        format: 2,
1296    },
1297    AttributeRow {
1298        relation_id: 0x00000011,
1299        attribute_id: 0x00000016,
1300        name_format: 2,
1301        name: Some(b"Verify"),
1302        name_id: None,
1303        format: 2,
1304    },
1305    AttributeRow {
1306        relation_id: 0x00000011,
1307        attribute_id: 0x00000017,
1308        name_format: 2,
1309        name: Some(b"SignRecover"),
1310        name_id: None,
1311        format: 2,
1312    },
1313    AttributeRow {
1314        relation_id: 0x00000011,
1315        attribute_id: 0x00000018,
1316        name_format: 2,
1317        name: Some(b"VerifyRecover"),
1318        name_id: None,
1319        format: 2,
1320    },
1321    AttributeRow {
1322        relation_id: 0x00000011,
1323        attribute_id: 0x00000019,
1324        name_format: 2,
1325        name: Some(b"Wrap"),
1326        name_id: None,
1327        format: 2,
1328    },
1329    AttributeRow {
1330        relation_id: 0x00000011,
1331        attribute_id: 0x0000001a,
1332        name_format: 2,
1333        name: Some(b"Unwrap"),
1334        name_id: None,
1335        format: 2,
1336    },
1337];
1338
1339pub const INDEXES: [IndexRow; 80] = [
1340    IndexRow {
1341        relation_id: 0x80000000,
1342        index_id: 0,
1343        attribute_id: 0x61636374,
1344        index_type: 0,
1345        indexed_data_location: 1,
1346    },
1347    IndexRow {
1348        relation_id: 0x80000000,
1349        index_id: 0,
1350        attribute_id: 0x73766365,
1351        index_type: 0,
1352        indexed_data_location: 1,
1353    },
1354    IndexRow {
1355        relation_id: 0x80000000,
1356        index_id: 3,
1357        attribute_id: 0x61636374,
1358        index_type: 1,
1359        indexed_data_location: 1,
1360    },
1361    IndexRow {
1362        relation_id: 0x80000000,
1363        index_id: 4,
1364        attribute_id: 0x73766365,
1365        index_type: 1,
1366        indexed_data_location: 1,
1367    },
1368    IndexRow {
1369        relation_id: 0x80000002,
1370        index_id: 0,
1371        attribute_id: 0x61636374,
1372        index_type: 0,
1373        indexed_data_location: 1,
1374    },
1375    IndexRow {
1376        relation_id: 0x80000002,
1377        index_id: 0,
1378        attribute_id: 0x766c6d65,
1379        index_type: 0,
1380        indexed_data_location: 1,
1381    },
1382    IndexRow {
1383        relation_id: 0x80000002,
1384        index_id: 0,
1385        attribute_id: 0x61646472,
1386        index_type: 0,
1387        indexed_data_location: 1,
1388    },
1389    IndexRow {
1390        relation_id: 0x80000002,
1391        index_id: 0,
1392        attribute_id: 0x73736967,
1393        index_type: 0,
1394        indexed_data_location: 1,
1395    },
1396    IndexRow {
1397        relation_id: 0x80000002,
1398        index_id: 5,
1399        attribute_id: 0x61636374,
1400        index_type: 1,
1401        indexed_data_location: 1,
1402    },
1403    IndexRow {
1404        relation_id: 0x80000002,
1405        index_id: 6,
1406        attribute_id: 0x766c6d65,
1407        index_type: 1,
1408        indexed_data_location: 1,
1409    },
1410    IndexRow {
1411        relation_id: 0x80000002,
1412        index_id: 7,
1413        attribute_id: 0x61646472,
1414        index_type: 1,
1415        indexed_data_location: 1,
1416    },
1417    IndexRow {
1418        relation_id: 0x80000002,
1419        index_id: 8,
1420        attribute_id: 0x73736967,
1421        index_type: 1,
1422        indexed_data_location: 1,
1423    },
1424    IndexRow {
1425        relation_id: 0x80000001,
1426        index_id: 0,
1427        attribute_id: 0x61636374,
1428        index_type: 0,
1429        indexed_data_location: 1,
1430    },
1431    IndexRow {
1432        relation_id: 0x80000001,
1433        index_id: 0,
1434        attribute_id: 0x73646d6e,
1435        index_type: 0,
1436        indexed_data_location: 1,
1437    },
1438    IndexRow {
1439        relation_id: 0x80000001,
1440        index_id: 0,
1441        attribute_id: 0x73727672,
1442        index_type: 0,
1443        indexed_data_location: 1,
1444    },
1445    IndexRow {
1446        relation_id: 0x80000001,
1447        index_id: 0,
1448        attribute_id: 0x7074636c,
1449        index_type: 0,
1450        indexed_data_location: 1,
1451    },
1452    IndexRow {
1453        relation_id: 0x80000001,
1454        index_id: 0,
1455        attribute_id: 0x61747970,
1456        index_type: 0,
1457        indexed_data_location: 1,
1458    },
1459    IndexRow {
1460        relation_id: 0x80000001,
1461        index_id: 0,
1462        attribute_id: 0x706f7274,
1463        index_type: 0,
1464        indexed_data_location: 1,
1465    },
1466    IndexRow {
1467        relation_id: 0x80000001,
1468        index_id: 0,
1469        attribute_id: 0x70617468,
1470        index_type: 0,
1471        indexed_data_location: 1,
1472    },
1473    IndexRow {
1474        relation_id: 0x80000001,
1475        index_id: 8,
1476        attribute_id: 0x61636374,
1477        index_type: 1,
1478        indexed_data_location: 1,
1479    },
1480    IndexRow {
1481        relation_id: 0x80000001,
1482        index_id: 9,
1483        attribute_id: 0x73646d6e,
1484        index_type: 1,
1485        indexed_data_location: 1,
1486    },
1487    IndexRow {
1488        relation_id: 0x80000001,
1489        index_id: 10,
1490        attribute_id: 0x73727672,
1491        index_type: 1,
1492        indexed_data_location: 1,
1493    },
1494    IndexRow {
1495        relation_id: 0x80000001,
1496        index_id: 11,
1497        attribute_id: 0x7074636c,
1498        index_type: 1,
1499        indexed_data_location: 1,
1500    },
1501    IndexRow {
1502        relation_id: 0x80000001,
1503        index_id: 12,
1504        attribute_id: 0x61747970,
1505        index_type: 1,
1506        indexed_data_location: 1,
1507    },
1508    IndexRow {
1509        relation_id: 0x80000001,
1510        index_id: 13,
1511        attribute_id: 0x706f7274,
1512        index_type: 1,
1513        indexed_data_location: 1,
1514    },
1515    IndexRow {
1516        relation_id: 0x80000001,
1517        index_id: 14,
1518        attribute_id: 0x70617468,
1519        index_type: 1,
1520        indexed_data_location: 1,
1521    },
1522    IndexRow {
1523        relation_id: 0x0000000f,
1524        index_id: 0,
1525        attribute_id: 0x00000006,
1526        index_type: 0,
1527        indexed_data_location: 1,
1528    },
1529    IndexRow {
1530        relation_id: 0x0000000f,
1531        index_id: 0,
1532        attribute_id: 0x00000007,
1533        index_type: 0,
1534        indexed_data_location: 1,
1535    },
1536    IndexRow {
1537        relation_id: 0x0000000f,
1538        index_id: 0,
1539        attribute_id: 0x00000008,
1540        index_type: 0,
1541        indexed_data_location: 1,
1542    },
1543    IndexRow {
1544        relation_id: 0x0000000f,
1545        index_id: 0,
1546        attribute_id: 0x00000009,
1547        index_type: 0,
1548        indexed_data_location: 1,
1549    },
1550    IndexRow {
1551        relation_id: 0x0000000f,
1552        index_id: 0,
1553        attribute_id: 0x0000000a,
1554        index_type: 0,
1555        indexed_data_location: 1,
1556    },
1557    IndexRow {
1558        relation_id: 0x0000000f,
1559        index_id: 0,
1560        attribute_id: 0x0000000b,
1561        index_type: 0,
1562        indexed_data_location: 1,
1563    },
1564    IndexRow {
1565        relation_id: 0x0000000f,
1566        index_id: 0,
1567        attribute_id: 0x0000000c,
1568        index_type: 0,
1569        indexed_data_location: 1,
1570    },
1571    IndexRow {
1572        relation_id: 0x0000000f,
1573        index_id: 0,
1574        attribute_id: 0x0000000d,
1575        index_type: 0,
1576        indexed_data_location: 1,
1577    },
1578    IndexRow {
1579        relation_id: 0x0000000f,
1580        index_id: 1,
1581        attribute_id: 0x00000006,
1582        index_type: 1,
1583        indexed_data_location: 1,
1584    },
1585    IndexRow {
1586        relation_id: 0x0000000f,
1587        index_id: 2,
1588        attribute_id: 0x00000012,
1589        index_type: 1,
1590        indexed_data_location: 1,
1591    },
1592    IndexRow {
1593        relation_id: 0x0000000f,
1594        index_id: 3,
1595        attribute_id: 0x00000013,
1596        index_type: 1,
1597        indexed_data_location: 1,
1598    },
1599    IndexRow {
1600        relation_id: 0x0000000f,
1601        index_id: 4,
1602        attribute_id: 0x00000014,
1603        index_type: 1,
1604        indexed_data_location: 1,
1605    },
1606    IndexRow {
1607        relation_id: 0x0000000f,
1608        index_id: 5,
1609        attribute_id: 0x00000015,
1610        index_type: 1,
1611        indexed_data_location: 1,
1612    },
1613    IndexRow {
1614        relation_id: 0x0000000f,
1615        index_id: 6,
1616        attribute_id: 0x00000016,
1617        index_type: 1,
1618        indexed_data_location: 1,
1619    },
1620    IndexRow {
1621        relation_id: 0x0000000f,
1622        index_id: 7,
1623        attribute_id: 0x00000017,
1624        index_type: 1,
1625        indexed_data_location: 1,
1626    },
1627    IndexRow {
1628        relation_id: 0x0000000f,
1629        index_id: 8,
1630        attribute_id: 0x00000018,
1631        index_type: 1,
1632        indexed_data_location: 1,
1633    },
1634    IndexRow {
1635        relation_id: 0x0000000f,
1636        index_id: 9,
1637        attribute_id: 0x00000019,
1638        index_type: 1,
1639        indexed_data_location: 1,
1640    },
1641    IndexRow {
1642        relation_id: 0x0000000f,
1643        index_id: 10,
1644        attribute_id: 0x0000001a,
1645        index_type: 1,
1646        indexed_data_location: 1,
1647    },
1648    IndexRow {
1649        relation_id: 0x00000010,
1650        index_id: 0,
1651        attribute_id: 0x00000006,
1652        index_type: 0,
1653        indexed_data_location: 1,
1654    },
1655    IndexRow {
1656        relation_id: 0x00000010,
1657        index_id: 0,
1658        attribute_id: 0x00000007,
1659        index_type: 0,
1660        indexed_data_location: 1,
1661    },
1662    IndexRow {
1663        relation_id: 0x00000010,
1664        index_id: 0,
1665        attribute_id: 0x00000008,
1666        index_type: 0,
1667        indexed_data_location: 1,
1668    },
1669    IndexRow {
1670        relation_id: 0x00000010,
1671        index_id: 0,
1672        attribute_id: 0x00000009,
1673        index_type: 0,
1674        indexed_data_location: 1,
1675    },
1676    IndexRow {
1677        relation_id: 0x00000010,
1678        index_id: 0,
1679        attribute_id: 0x0000000a,
1680        index_type: 0,
1681        indexed_data_location: 1,
1682    },
1683    IndexRow {
1684        relation_id: 0x00000010,
1685        index_id: 0,
1686        attribute_id: 0x0000000b,
1687        index_type: 0,
1688        indexed_data_location: 1,
1689    },
1690    IndexRow {
1691        relation_id: 0x00000010,
1692        index_id: 0,
1693        attribute_id: 0x0000000c,
1694        index_type: 0,
1695        indexed_data_location: 1,
1696    },
1697    IndexRow {
1698        relation_id: 0x00000010,
1699        index_id: 0,
1700        attribute_id: 0x0000000d,
1701        index_type: 0,
1702        indexed_data_location: 1,
1703    },
1704    IndexRow {
1705        relation_id: 0x00000010,
1706        index_id: 1,
1707        attribute_id: 0x00000006,
1708        index_type: 1,
1709        indexed_data_location: 1,
1710    },
1711    IndexRow {
1712        relation_id: 0x00000010,
1713        index_id: 2,
1714        attribute_id: 0x00000012,
1715        index_type: 1,
1716        indexed_data_location: 1,
1717    },
1718    IndexRow {
1719        relation_id: 0x00000010,
1720        index_id: 3,
1721        attribute_id: 0x00000013,
1722        index_type: 1,
1723        indexed_data_location: 1,
1724    },
1725    IndexRow {
1726        relation_id: 0x00000010,
1727        index_id: 4,
1728        attribute_id: 0x00000014,
1729        index_type: 1,
1730        indexed_data_location: 1,
1731    },
1732    IndexRow {
1733        relation_id: 0x00000010,
1734        index_id: 5,
1735        attribute_id: 0x00000015,
1736        index_type: 1,
1737        indexed_data_location: 1,
1738    },
1739    IndexRow {
1740        relation_id: 0x00000010,
1741        index_id: 6,
1742        attribute_id: 0x00000016,
1743        index_type: 1,
1744        indexed_data_location: 1,
1745    },
1746    IndexRow {
1747        relation_id: 0x00000010,
1748        index_id: 7,
1749        attribute_id: 0x00000017,
1750        index_type: 1,
1751        indexed_data_location: 1,
1752    },
1753    IndexRow {
1754        relation_id: 0x00000010,
1755        index_id: 8,
1756        attribute_id: 0x00000018,
1757        index_type: 1,
1758        indexed_data_location: 1,
1759    },
1760    IndexRow {
1761        relation_id: 0x00000010,
1762        index_id: 9,
1763        attribute_id: 0x00000019,
1764        index_type: 1,
1765        indexed_data_location: 1,
1766    },
1767    IndexRow {
1768        relation_id: 0x00000010,
1769        index_id: 10,
1770        attribute_id: 0x0000001a,
1771        index_type: 1,
1772        indexed_data_location: 1,
1773    },
1774    IndexRow {
1775        relation_id: 0x00000011,
1776        index_id: 0,
1777        attribute_id: 0x00000006,
1778        index_type: 0,
1779        indexed_data_location: 1,
1780    },
1781    IndexRow {
1782        relation_id: 0x00000011,
1783        index_id: 0,
1784        attribute_id: 0x00000007,
1785        index_type: 0,
1786        indexed_data_location: 1,
1787    },
1788    IndexRow {
1789        relation_id: 0x00000011,
1790        index_id: 0,
1791        attribute_id: 0x00000008,
1792        index_type: 0,
1793        indexed_data_location: 1,
1794    },
1795    IndexRow {
1796        relation_id: 0x00000011,
1797        index_id: 0,
1798        attribute_id: 0x00000009,
1799        index_type: 0,
1800        indexed_data_location: 1,
1801    },
1802    IndexRow {
1803        relation_id: 0x00000011,
1804        index_id: 0,
1805        attribute_id: 0x0000000a,
1806        index_type: 0,
1807        indexed_data_location: 1,
1808    },
1809    IndexRow {
1810        relation_id: 0x00000011,
1811        index_id: 0,
1812        attribute_id: 0x0000000b,
1813        index_type: 0,
1814        indexed_data_location: 1,
1815    },
1816    IndexRow {
1817        relation_id: 0x00000011,
1818        index_id: 0,
1819        attribute_id: 0x0000000c,
1820        index_type: 0,
1821        indexed_data_location: 1,
1822    },
1823    IndexRow {
1824        relation_id: 0x00000011,
1825        index_id: 0,
1826        attribute_id: 0x0000000d,
1827        index_type: 0,
1828        indexed_data_location: 1,
1829    },
1830    IndexRow {
1831        relation_id: 0x00000011,
1832        index_id: 1,
1833        attribute_id: 0x00000006,
1834        index_type: 1,
1835        indexed_data_location: 1,
1836    },
1837    IndexRow {
1838        relation_id: 0x00000011,
1839        index_id: 2,
1840        attribute_id: 0x00000012,
1841        index_type: 1,
1842        indexed_data_location: 1,
1843    },
1844    IndexRow {
1845        relation_id: 0x00000011,
1846        index_id: 3,
1847        attribute_id: 0x00000013,
1848        index_type: 1,
1849        indexed_data_location: 1,
1850    },
1851    IndexRow {
1852        relation_id: 0x00000011,
1853        index_id: 4,
1854        attribute_id: 0x00000014,
1855        index_type: 1,
1856        indexed_data_location: 1,
1857    },
1858    IndexRow {
1859        relation_id: 0x00000011,
1860        index_id: 5,
1861        attribute_id: 0x00000015,
1862        index_type: 1,
1863        indexed_data_location: 1,
1864    },
1865    IndexRow {
1866        relation_id: 0x00000011,
1867        index_id: 6,
1868        attribute_id: 0x00000016,
1869        index_type: 1,
1870        indexed_data_location: 1,
1871    },
1872    IndexRow {
1873        relation_id: 0x00000011,
1874        index_id: 7,
1875        attribute_id: 0x00000017,
1876        index_type: 1,
1877        indexed_data_location: 1,
1878    },
1879    IndexRow {
1880        relation_id: 0x00000011,
1881        index_id: 8,
1882        attribute_id: 0x00000018,
1883        index_type: 1,
1884        indexed_data_location: 1,
1885    },
1886    IndexRow {
1887        relation_id: 0x00000011,
1888        index_id: 9,
1889        attribute_id: 0x00000019,
1890        index_type: 1,
1891        indexed_data_location: 1,
1892    },
1893    IndexRow {
1894        relation_id: 0x00000011,
1895        index_id: 10,
1896        attribute_id: 0x0000001a,
1897        index_type: 1,
1898        indexed_data_location: 1,
1899    },
1900];
1901
1902pub const TABLES: [TableTemplate; 11] = [
1903    TableTemplate { relation_id: 0x00000000, free_list: 0x00000000, index_data: b"\x00\x00\x00\x08\x00\x00\x00\x00" },
1904    TableTemplate { relation_id: 0x00000001, free_list: 0x00000000, index_data: b"\x00\x00\x00\x08\x00\x00\x00\x00" },
1905    TableTemplate { relation_id: 0x00000002, free_list: 0x00000000, index_data: b"\x00\x00\x00\x08\x00\x00\x00\x00" },
1906    TableTemplate { relation_id: 0x00000003, free_list: 0x0000001d, index_data: b"\x00\x00\x00\x08\x00\x00\x00\x00" },
1907    TableTemplate { relation_id: 0x0000000f, free_list: 0x0000001d, index_data: b"\x00\x00\x01\x58\x00\x00\x00\x0b\x00\x00\x00\x54\x00\x00\x00\x88\x00\x00\x00\xa0\x00\x00\x00\xb8\x00\x00\x00\xd0\x00\x00\x00\xe8\x00\x00\x01\x00\x00\x00\x01\x18\x00\x00\x01\x30\x00\x00\x01\x48\x00\x00\x01\x60\x00\x00\x00\x34\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x08\x00\x00\x00\x06\x00\x00\x00\x07\x00\x00\x00\x08\x00\x00\x00\x09\x00\x00\x00\x0a\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x13\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x09\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x1a\x00\x00\x00\x00" },
1908    TableTemplate { relation_id: 0x00000010, free_list: 0x0000001d, index_data: b"\x00\x00\x01\x58\x00\x00\x00\x0b\x00\x00\x00\x54\x00\x00\x00\x88\x00\x00\x00\xa0\x00\x00\x00\xb8\x00\x00\x00\xd0\x00\x00\x00\xe8\x00\x00\x01\x00\x00\x00\x01\x18\x00\x00\x01\x30\x00\x00\x01\x48\x00\x00\x01\x60\x00\x00\x00\x34\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x08\x00\x00\x00\x06\x00\x00\x00\x07\x00\x00\x00\x08\x00\x00\x00\x09\x00\x00\x00\x0a\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x13\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x09\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x1a\x00\x00\x00\x00" },
1909    TableTemplate { relation_id: 0x00000011, free_list: 0x0000001d, index_data: b"\x00\x00\x01\x58\x00\x00\x00\x0b\x00\x00\x00\x54\x00\x00\x00\x88\x00\x00\x00\xa0\x00\x00\x00\xb8\x00\x00\x00\xd0\x00\x00\x00\xe8\x00\x00\x01\x00\x00\x00\x01\x18\x00\x00\x01\x30\x00\x00\x01\x48\x00\x00\x01\x60\x00\x00\x00\x34\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x08\x00\x00\x00\x06\x00\x00\x00\x07\x00\x00\x00\x08\x00\x00\x00\x09\x00\x00\x00\x0a\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x13\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x16\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x09\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x1a\x00\x00\x00\x00" },
1910    TableTemplate { relation_id: 0x80000000, free_list: 0x0000001d, index_data: b"\x00\x00\x00\x60\x00\x00\x00\x03\x00\x00\x00\x34\x00\x00\x00\x50\x00\x00\x00\x68\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\x61\x63\x63\x74\x73\x76\x63\x65\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x01\x61\x63\x63\x74\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x01\x73\x76\x63\x65\x00\x00\x00\x00" },
1911    TableTemplate { relation_id: 0x80000001, free_list: 0x0000001d, index_data: b"\x00\x00\x01\x00\x00\x00\x00\x08\x00\x00\x00\x48\x00\x00\x00\x78\x00\x00\x00\x90\x00\x00\x00\xa8\x00\x00\x00\xc0\x00\x00\x00\xd8\x00\x00\x00\xf0\x00\x00\x01\x08\x00\x00\x00\x30\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x07\x61\x63\x63\x74\x73\x64\x6d\x6e\x73\x72\x76\x72\x70\x74\x63\x6c\x61\x74\x79\x70\x70\x6f\x72\x74\x70\x61\x74\x68\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x01\x61\x63\x63\x74\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x09\x00\x00\x00\x00\x00\x00\x00\x01\x73\x64\x6d\x6e\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x01\x73\x72\x76\x72\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x01\x70\x74\x63\x6c\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x01\x61\x74\x79\x70\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x01\x70\x6f\x72\x74\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x01\x70\x61\x74\x68\x00\x00\x00\x00" },
1912    TableTemplate { relation_id: 0x80000002, free_list: 0x0000001d, index_data: b"\x00\x00\x00\xa0\x00\x00\x00\x05\x00\x00\x00\x3c\x00\x00\x00\x60\x00\x00\x00\x78\x00\x00\x00\x90\x00\x00\x00\xa8\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x61\x63\x63\x74\x76\x6c\x6d\x65\x61\x64\x64\x72\x73\x73\x69\x67\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x01\x61\x63\x63\x74\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x01\x76\x6c\x6d\x65\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x01\x61\x64\x64\x72\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x01\x73\x73\x69\x67\x00\x00\x00\x00" },
1913    TableTemplate { relation_id: 0x80008000, free_list: 0x00000000, index_data: b"\x00\x00\x00\x08\x00\x00\x00\x00" },
1914];
1915
1916/// A relation macOS does not put in a new keychain, but adds to the schema the
1917/// first time a record of that type is stored. `security import` writes exactly
1918/// these rows, in this order, when it stores the first certificate.
1919pub struct OnDemandRelation {
1920    pub relation: RelationRow,
1921    pub attributes: &'static [AttributeRow],
1922    pub indexes: &'static [IndexRow],
1923    /// The free-list field of the new, still-empty table.
1924    pub free_list: u32,
1925}
1926
1927/// `CSSM_DL_DB_RECORD_X509_CERTIFICATE`, added on the first certificate.
1928pub const X509_CERTIFICATE_RELATION: OnDemandRelation = OnDemandRelation {
1929    relation: RelationRow {
1930        relation_id: 0x80001000,
1931        name: Some(b"CSSM_DL_DB_RECORD_X509_CERTIFICATE"),
1932    },
1933    attributes: &X509_CERTIFICATE_ATTRIBUTES,
1934    indexes: &X509_CERTIFICATE_INDEXES,
1935    free_list: 0x0000001d,
1936};
1937
1938/// Relations this code knows how to add to a keychain's schema.
1939pub const ON_DEMAND_RELATIONS: [&OnDemandRelation; 1] = [&X509_CERTIFICATE_RELATION];
1940
1941pub const X509_CERTIFICATE_ATTRIBUTES: [AttributeRow; 9] = [
1942    AttributeRow {
1943        relation_id: 0x80001000,
1944        attribute_id: 0x63747970,
1945        name_format: 2,
1946        name: Some(b"CertType"),
1947        name_id: None,
1948        format: 2,
1949    },
1950    AttributeRow {
1951        relation_id: 0x80001000,
1952        attribute_id: 0x63656e63,
1953        name_format: 2,
1954        name: Some(b"CertEncoding"),
1955        name_id: None,
1956        format: 2,
1957    },
1958    AttributeRow {
1959        relation_id: 0x80001000,
1960        attribute_id: 0x6c61626c,
1961        name_format: 2,
1962        name: Some(b"PrintName"),
1963        name_id: None,
1964        format: 6,
1965    },
1966    AttributeRow {
1967        relation_id: 0x80001000,
1968        attribute_id: 0x616c6973,
1969        name_format: 2,
1970        name: Some(b"Alias"),
1971        name_id: None,
1972        format: 6,
1973    },
1974    AttributeRow {
1975        relation_id: 0x80001000,
1976        attribute_id: 0x7375626a,
1977        name_format: 2,
1978        name: Some(b"Subject"),
1979        name_id: None,
1980        format: 6,
1981    },
1982    AttributeRow {
1983        relation_id: 0x80001000,
1984        attribute_id: 0x69737375,
1985        name_format: 2,
1986        name: Some(b"Issuer"),
1987        name_id: None,
1988        format: 6,
1989    },
1990    AttributeRow {
1991        relation_id: 0x80001000,
1992        attribute_id: 0x736e6272,
1993        name_format: 2,
1994        name: Some(b"SerialNumber"),
1995        name_id: None,
1996        format: 6,
1997    },
1998    AttributeRow {
1999        relation_id: 0x80001000,
2000        attribute_id: 0x736b6964,
2001        name_format: 2,
2002        name: Some(b"SubjectKeyIdentifier"),
2003        name_id: None,
2004        format: 6,
2005    },
2006    AttributeRow {
2007        relation_id: 0x80001000,
2008        attribute_id: 0x68706b79,
2009        name_format: 2,
2010        name: Some(b"PublicKeyHash"),
2011        name_id: None,
2012        format: 6,
2013    },
2014];
2015
2016pub const X509_CERTIFICATE_INDEXES: [IndexRow; 10] = [
2017    IndexRow {
2018        relation_id: 0x80001000,
2019        index_id: 0,
2020        attribute_id: 0x63747970,
2021        index_type: 0,
2022        indexed_data_location: 1,
2023    },
2024    IndexRow {
2025        relation_id: 0x80001000,
2026        index_id: 0,
2027        attribute_id: 0x69737375,
2028        index_type: 0,
2029        indexed_data_location: 1,
2030    },
2031    IndexRow {
2032        relation_id: 0x80001000,
2033        index_id: 0,
2034        attribute_id: 0x736e6272,
2035        index_type: 0,
2036        indexed_data_location: 1,
2037    },
2038    IndexRow {
2039        relation_id: 0x80001000,
2040        index_id: 1,
2041        attribute_id: 0x63747970,
2042        index_type: 1,
2043        indexed_data_location: 1,
2044    },
2045    IndexRow {
2046        relation_id: 0x80001000,
2047        index_id: 2,
2048        attribute_id: 0x616c6973,
2049        index_type: 1,
2050        indexed_data_location: 1,
2051    },
2052    IndexRow {
2053        relation_id: 0x80001000,
2054        index_id: 3,
2055        attribute_id: 0x7375626a,
2056        index_type: 1,
2057        indexed_data_location: 1,
2058    },
2059    IndexRow {
2060        relation_id: 0x80001000,
2061        index_id: 4,
2062        attribute_id: 0x69737375,
2063        index_type: 1,
2064        indexed_data_location: 1,
2065    },
2066    IndexRow {
2067        relation_id: 0x80001000,
2068        index_id: 5,
2069        attribute_id: 0x736e6272,
2070        index_type: 1,
2071        indexed_data_location: 1,
2072    },
2073    IndexRow {
2074        relation_id: 0x80001000,
2075        index_id: 6,
2076        attribute_id: 0x736b6964,
2077        index_type: 1,
2078        indexed_data_location: 1,
2079    },
2080    IndexRow {
2081        relation_id: 0x80001000,
2082        index_id: 7,
2083        attribute_id: 0x68706b79,
2084        index_type: 1,
2085        indexed_data_location: 1,
2086    },
2087];