]> git.cameronkatri.com Git - trustcache.git/blob - tc.1
append: Allow specifying cdhash directly
[trustcache.git] / tc.1
1 .\"-
2 .\" Copyright (c) 2022 Cameron Katri. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY CAMERON KATRI AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL CAMERON KATRI OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .Dd May 19, 2022
26 .Dt TC 1
27 .Os
28 .Sh NAME
29 .Nm tc
30 .Nd Create and interact with trustcaches
31 .Sh SYNOPSIS
32 .Nm
33 .Cm append
34 .Op Fl f Ar flags
35 .Op Fl u Ar uuid | 0
36 .Ar infile
37 .Ar
38 .Nm
39 .Cm create
40 .Op Fl u Ar uuid
41 .Op Fl v Ar version
42 .Ar outfile
43 .Ar
44 .Nm
45 .Cm info
46 .Op Fl c
47 .Op Fl h
48 .Op Fl e Ar entrynum
49 .Ar file
50 .Nm
51 .Cm remove
52 .Op Fl k
53 .Ar file
54 .Ar hash ...
55 .Sh DESCRIPTION
56 The
57 .Nm
58 utility is used to get info about and modify Apple trustcaches.
59 .Pp
60 The following commands are supported by
61 .Nm :
62 .Bl -tag -width create
63 .It Xo
64 .Cm append
65 .Op Fl f Ar flags
66 .Op Fl u Ar uuid | 0
67 .Ar infile
68 .Ar
69 .Xc
70 Modify the trustcache at
71 .Ar infile
72 to include each signed Mach-O at the specified paths.
73 If
74 .Ar file
75 is both 40 characters and hexadecimal, that hash will be added to the cache.
76 .Ar uuid
77 is used to specify a custom uuid to be used.
78 If it is
79 .Ar 0 ,
80 the uuid will be left the same, otherwise, it will be regenerated.
81 If
82 .Fl f
83 is specified, any new entries with have the flags specified at
84 .Ar flags .
85 .It Xo
86 .Cm create
87 .Op Fl u Ar uuid
88 .Op Fl v Ar version
89 .Ar outfile
90 .Ar
91 .Xc
92 Create a trustcache at
93 .Ar outfile .
94 Each Mach-O found in the specified inputs will be scanned for
95 a code signature and hashed.
96 Any malformed or unsigned Mach-O will be ignored.
97 Each slice of a FAT binary will have its hash included.
98 Versions 0 and 1 are supported, if not specified, 1 is assumed.
99 If
100 .Ar uuid
101 is specified, that will be used instead of a randomly generated one.
102 .It Xo
103 .Cm info
104 .Op Fl c
105 .Op Fl h
106 .Op Fl e Ar entrynum
107 .Ar file
108 .Xc
109 Print information about
110 .Ar file .
111 The output for each hash will be in the format:
112 .Pp
113 .Dl <cdhash> <flags> [<hash_type>]
114 .Pp
115 If the
116 .Fl c
117 is given, only the hashes will be printed.
118 If
119 .Fl h
120 is given, only the header will be printed.
121 If
122 .Ar entrynum
123 is specified, only that entry will be printed.
124 .It Xo
125 .Cm remove
126 .Op Fl k
127 .Ar file
128 .Ar hash ...
129 .Xc
130 Remove each specified hash from
131 .Ar file .
132 If
133 .Fl k
134 is specified, the uuid will not be regenerated.
135 The number of removed entries will be printed.
136 .El
137 .Sh EXIT STATUS
138 .Ex -std
139 .Sh SEE ALSO
140 .Xr cryptex-dump-trust-cache 1 ,
141 .Xr cryptex-generate-trust-cache 1
142 .Sh HISTORY
143 The
144 .Nm
145 utility was written by
146 .An Cameron Katri Aq Mt me@cameronkatri.com .