2006-06-15 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / tools / security / TESTS
1 Mono's Security Tools - TESTS
2 Last updated: June 13, 2006
3
4 * AUTHENTICODE
5
6 Here's a short description on how to test any changes in the Authenticode tool
7 set. This set includes makecert, cert2spc, signcode and chktrust.
8
9 This is a _minimal_ sequence. Each input/output could be tested under Linux 
10 and Windows to ensure maximum compatibility.
11
12
13 0. Setup
14
15         % cd /mcs/tools/security
16         % make
17         % mono setreg.exe 1 TRUE
18         % cp signcode.exe test.exe
19
20 1. Create a test certificate for code-signing
21
22         % mono makecert.exe -n "CN=careful tester" -sv test.pvk test.cer
23
24         Mono MakeCert - version 1.1.15.0
25         X.509 Certificate Builder
26         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
27  
28         Success
29
30 2. Convert the test certificate to the SPC format
31
32         % mono cert2spc.exe test.cer test.spc
33
34         Mono Cert2Spc - version 1.1.15.0
35         Transform a set of X.509 certificates and CRLs into an Authenticode(TM) "Software Publisher Certificate"
36         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
37  
38         Success
39
40 3. Sign a PE binary (without a timestamp)
41
42         % mono signcode.exe -v test.pvk -spc test.spc test.exe
43
44         Mono SignCode - version 1.1.15.0
45         Sign assemblies and PE files using Authenticode(tm).
46         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
47
48         Success
49
50 4. Verify the binary from step 3
51
52         % mono chktrust.exe test.exe
53
54         Mono CheckTrust - version 1.1.15.0
55         Verify if an PE executable has a valid Authenticode(tm) signature
56         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
57  
58         WARNING! test.exe is not timestamped!
59         SUCCESS: test.exe signature is valid
60         and can be traced back to a trusted root!
61
62         *** note the warning about the missing timestamp ***
63
64 5. Verify the binary from step 3 using MS tools [1]
65
66         a. Using Windows Explorer, right click on the test.exe file and select
67         the "Properties" menu item;
68         b. From the "test.exe Properties" windows select the "Digital 
69         Signatures" tab;
70         c. You should see "careful tester" as the "Name of signer", select it
71         and click on the "Details" button;
72         d. Unless you have created your test certificate with MS tools you 
73         should see an error (white X on a red circle) with a description 
74         saying "The certificate in the signature cannot be verified.";
75         e. You should NOT see any countersignature;
76
77 6. Add a timestamp the binary from step 3
78
79         % mono signcode.exe -x -t http://timestamp.verisign.com/scripts/timstamp.dll test.exe
80
81         Mono SignCode - version 1.1.15.0
82         Sign assemblies and PE files using Authenticode(tm).
83         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
84  
85         Success
86
87 7. Verify the binary from step 6
88
89         % mono chktrust.exe test.exe
90
91         Mono CheckTrust - version 1.1.15.0
92         Verify if an PE executable has a valid Authenticode(tm) signature
93         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
94  
95         SUCCESS: test.exe signature is valid
96         and can be traced back to a trusted root!
97
98         *** note that there is NO warning this time ***
99
100 8. Verify the binary from step 6 on Windows [1]
101
102         a. Follow step 5 from 'a' to 'd'
103         b. This time you should see a countersignature;
104
105 9. Sign a PE binary with a timestamp
106
107         % mono signcode.exe -v test.pvk -spc test.spc -t http://timestamp.verisign.com/scripts/timstamp.dll test.exe
108
109         Mono SignCode - version 1.1.15.0
110         Sign assemblies and PE files using Authenticode(tm).
111         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
112  
113         Success
114
115 10. Verify the binary from step 9
116
117         % mono chktrust.exe test.exe
118
119         Mono CheckTrust - version 1.1.15.0
120         Verify if an PE executable has a valid Authenticode(tm) signature
121         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
122  
123         SUCCESS: test.exe signature is valid
124         and can be traced back to a trusted root!
125
126 11. Verify the binary from step 9 on Windows [1]
127
128         a. Follow step 5 from 'a' to 'd'
129         b. This time you should see a countersignature;
130
131 12. Add (another) timestamp the binary from step 9
132
133         % mono signcode.exe -x -t http://timestamp.verisign.com/scripts/timstamp.dll test.exe
134
135         Mono SignCode - version 1.1.15.0
136         Sign assemblies and PE files using Authenticode(tm).
137         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
138  
139         Success
140
141 13. Verify the binary from step 12
142
143         Mono CheckTrust - version 1.1.15.0
144         Verify if an PE executable has a valid Authenticode(tm) signature
145         Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.
146  
147         SUCCESS: test.exe signature is valid
148         and can be traced back to a trusted root!
149
150 14. Verify the binary from step 12 on Windows [1]
151
152         a. Follow step 5 from 'a' to 'd'
153         b. This time you should see TWO (2) countersignature, the same one as
154         step 11 and a new one;
155
156 15. Clean up
157
158         % rm test.*
159         % mono setreg.exe 1 FALSE
160
161
162 [1] this step must be done on Windows using MS Authenticode(r) tools.
163 --------------------
164 sebastien@ximian.com