fix msvc build.
[mono/afaerber.git] / web / crypto
blob56fbde78316e3f083ccb3948acc992ef7ce563bb
1 * Cryptography
3         In the .NET framework cryptography can be found under a number of
4         namespaces in several assemblies. Mono also has it's own assemblies
5         to provide missing security functionalities from the .NET framework.
7 ** Assembly: corlib
9 *** Namespace: <b>System.Security.Cryptography</b>
11         Thanks to the work of many people this namespace is almost complete.
13 **** Status
14         <ul>
15                 * All classes are present. Most of them have (minimal) 
16                   documentation in <b>monodoc</b>.
18                 * Most classes have their unit tests. Some tests like <code>
19                   SymmetricAlgorithmTest</code> are generated by external 
20                   tools.
21         </ul>
23 *** Namespace: <b>System.Security.Cryptography.X509Certificates</b>
25 **** Status
26         <ul>
27                 * X.509 certificates are parsed using 100% managed code 
28                   (using the Mono.Security.ASN1 class). 
30                 * Software Publisher Certificates (SPC) used by Authenticode
31                   (tm) to sign assemblies are supported and <b>minimally</b>
32                   validated.
34                 * Unit tests are generated from a set of existing certificates
35                   (about a dozen) each having different properties. Another
36                   set of certificates (more than 700) are used for a more 
37                   complete test (but isn't part of the standard test suite for 
38                   size and time consideration, i.e. a 7.5Mb C# source file).
39         </ul>
41 **** Notes
42         <ul>
43                 * The class Mono.Security.X509.X509Certificate (in Mono.Security 
44                   assembly) is becoming a much better alternative - and will 
45                   continue to evolve to support the security tools.
46         </ul>
48 <hr>
49 ** Assembly: System.Security
51 *** Namespace: <b>System.Security.Cryptography.Xml</b>
53         This namespace implements the <a href="http://www.w3.org/TR/xmldsig-core/">
54         XML Digital Signature</a> specification from 
55         <a href="http://www.w3.org/">W3C</a>.
57 **** Status
58         <ul>
59                 * We pass the fifteen tests from Merlin's xmldsig suite with
60                 success. Which is funny because Microsoft fails in one case 
61                 where both a X509Certificate and an X509CRL are present in
62                 an X509Data. We also pass most Phaos tests.
64                 * Most classes have their unit tests. Some standalone tests 
65                 are also in CVS to test C14N and both Merlin and Phaos test
66                 suites.
67         </ul>
69 <hr>
70 ** Assembly: Mono.Security
72         <b>Rational: </b>
73         This assembly provides the missing pieces to .NET security. On Windows
74         CryptoAPI is often used to provide much needed functionalities (like
75         some cryptographic algorithms, code signing, X.509 certificates). Mono,
76         for platform independance, implements these functionalities in 100% 
77         managed code.
79 *** Namespace: Mono.Security
80         <ul>
81                 * Structures (ASN1, PKCS7) and primitives (PKCS1).
82         </ul>
83 *** Namespace: Mono.Security.Authenticode
84         <ul>
85                 * Code signing and verification.
86                 * Support for SPC (Software Publisher Certificate) files and 
87                   PVK (Private Key) files.
88         </ul>
89 *** Namespace: Mono.Security.Cryptography
90         <ul>
91                 * Additional algorithms: MD2, MD4, ARCFOUR (required for SSL)
92                 * Convertion helpers
93         </ul>
94 *** Namespace: Mono.Security.Protocol.*
95         <ul>
96                 * Tls: An 100% managed SSLv3 and TLSv1 implementation from 
97                 Carlos Guzman Alvarez.
98                 * Ntlm: NTLM authentication (used for HTTP and SQL Server).
99         </ul>
100 *** Namespace: Mono.Security.X509.*
101         <ul>
102                 * X.509 structures (certificate, CRL...) building and decoding.
103                 * PKCS#12 decoding and encoding.
104                 * X.509 extensions (from public X.509 to private PKIX, Netsapce, 
105                   Microsoft, Entrust...).
106         </ul>
108 **** Status
109         <ul>
110                 * A big part of this assembly is also included inside Mono's
111                   corlib. The classes are duplicated in this assembly so the 
112                   functionalities can be used without a dependency on Mono's 
113                   corlib (which depends on Mono's runtime).
115                 * Unit test coverage isn't (yet) complete.
117                 * Most classes have minimal documentation available in
118                   <b>monodoc</b>.
119         </ul>
121 <hr>
122 ** Assembly: Mono.Security.Win32
124         <b>Rational: </b>
125         This assembly goal is to provide maximum compatibility with CryptoAPI
126         to application running with Mono's runtime on the Windows operating 
127         system.
129         <b>This assembly should NEVER be used directly by any application</b>
130         (e.g. referecing the assembly from a project).
131         The classes should only be used by modifying the <code>machine.config
132         </code> configuration file (and then only if this increased 
133         compatibility is required by an application).
135         See the file <code><a href="http://cvs.hispalinux.es/cgi-bin/cvsweb/~checkout~/mcs/class/Mono.Security.Win32/README?rev=1.1&content-type=text/plain&cvsroot=mono">/mcs/class/Mono.Security.Win32/README</a></code>
136         for complete instructions.
138 *** Namespace: Mono.Security.Cryptography
140 **** Status
141         <ul>
142                 * A RNGCryptoServiceProvider built on top of CryptoAPI.
144                 * Wrapper classes for unmanaged versions of hash algorithms:
145                   MD2, MD4, MD5 and SHA1 are supported. <b>note</b>: some 
146                   algorithms shouldn't be used in new design (MD4 is broken, 
147                   MD2 and MD5 aren't considered safe for some usage). They are 
148                   included to preserve interoperability with older applications
149                   (e.g. some old, but still valid, X.509 certificates use MD2,
150                   MD4 is required for NTLM authentication ...).
152                 * Classes have minimal documentation available in
153                   <b>monodoc</b>.
154         </ul>
156 **** TODO
157         <ul>
158                 * Wrapper classes for unmanaged versions of symmetric 
159                   encryption algorithms (like DES, TripleDES, RC2 and others 
160                   present in default CSP).
162                 * Wrapper classes for unmanaged versions of asymmetric 
163                   algorithms (like DSA and RSA) which persist their keypair 
164                   into the specified CSP.
165         </ul>
167 **** Ideas
168         <ul>
169                 * Similar assemblies (e.g. <code>Mono.Security.XXX</code>) 
170                   could be created for <a href="http://www.openssl.org">OpenSSL</a>,
171                   <a href="http://www.mozilla.org/projects/security/pki/nss/">NSS</a>,
172                   <a href="http://www.eskimo.com/~weidai/cryptlib.html">crypto++</a>,
173                   <a href="http://www.cryptlib.orion.co.nz/">cryptlib</a> ... for 
174                   improved performance and/or HSM (Hardware Security Module) support 
175                   under Linux and/or Windows.
176         </ul>
177 <hr>
178 ** Assembly: Microsoft.Web.Services
180         Microsoft Web Service Enhancement (WSE), known as Web Service 
181         Development Kit (WSDK) in it's beta days, is an add-on the .NET
182         framework that implements WS-Security (and other WS-* specifications).
183         It also includes improved support for XML Signature (replacing and/or
184         extending <code>System.Security.Cryptography.Xml</code>) and X.509
185         certificates classes.
187         Note: WSE is distributed as an add-on because some specifications,
188         like WS-Security, aren't yet completed by 
189         <a href="http://www.oasis-open.org/committees/wss/">OASIS</a> or
190         other committees.
192 *** Namespace: Microsoft.Web.Services.Security
194 **** Status
195         <ul>
196                 * Most WSE 1.0 classes are implemented.
197         </ul>
199 **** TODO
200         <ul>
201                 * Some classes from System.Security assembly need to be 
202                 duplicated (and somewhat fixed) in WSE for XMLDSIG.
204                 * There are still missing classes and <b>many</b> missing
205                 unit tests.
206         </ul>
209 *** Namespace: Microsoft.Web.Services.Timestamp
211 **** Status
212         <ul>
213                 * This seems complete for WSE 1.0 but some new classes were 
214                 introduced in WSE 2.0.
215         </ul>
217 *** Namespace: Microsoft.Web.Services.Security.X509
219 **** Status
220         <ul>
221                 * X509Certificate support is complete for both WSE 1.0 and 2.0.
222         </ul>
224 **** TODO
225         <ul>
226                 * We need to define certificate stores (for both users and
227                   machines). These sames stores must be linked with asymmetric
228                   keypairs. This could also be used to store the SPC roots.
229         </ul>
231 *** Notes
232         <ul>
233                 * Microsoft has released WSE 2.
234         </ul>
236 <hr>
237 ** Tools
239         There are many tools in the .NET framework that indirectly interacts 
240         with some cryptographic classes. Unless noted the tools should work on
241         any CLR (tested with both Mono and Microsoft).
243 **** Status
245         The following tools are complete (or mostly complete):
246         <ul>
247                 * <code>secutil</code> is a tool to extract certificates and 
248                   strongnames from assemblies in a format that can be easily 
249                   re-used in source code (C# or VB.NET syntax).
251                 * <code>cert2spc</code> is a tool to transform multiple X.509 
252                    certificates and CRLs into a Software Publisher Certificate
253                   (SPC) file - which is a long name for a simple PKCS#7 file.
255                 * <code>makecert</code> to create X.509 test certificates that 
256                   can be used (once transformed in SPC) to sign assemblies. It's
257                   now possible to generate SSL certificates for web servers.
259                 * <code>sn</code> is a clone of the <code>sn</code> to manage
260                   strongnames. Current version can create, convert, sign and
261                   verify strongnames signatures. Some configuration options 
262                   are still missing, some will only works with Mono.
264                 * <code>signcode</code> and <code>chktrust</code> for signing 
265                   and validating Authenticode(tm) signatures on assemblies (or 
266                   any PE file) are now working (signature and timestamps) but 
267                   some options aren't yet supported.
269                 * <code>setreg</code> can change some cryptographic parameters
270                 of the runtime. Currently it can add or remove two root test
271                 certificates (the one used by Mono's <code>makecert</code>, 
272                 the other used by Microsoft's <code>makecert</code>).
274                 * <code>certmgr</code> can add and remove certificates from 
275                 the stores. Most common use is to add new trusted certificates
276                 or remove them.
277         </ul>
279         Somewhat usable, somewhat incomplete:
280         <ul>
281                 * <code>certview</code> is a certificate viewer for 
282                   <code>System.Windows.Forms</code> (right now only working on 
283                   Windows), while <code>gcertview</code> is the same viewer 
284                   implemented for GTK# (working on both Windows and Linux).
285         </ul>
288 **** TODO
289         The following tools are still missing or largely incomplete:
290         <ul>
291                 * Other tools like a, GUI-based, certificate manager...
292         </ul>
294         Note that many of the tools requires the class library and/or the
295         runtime to be ready for them. E.g. StrongName and Authenticode signatures
296         tools are of limited use until supported by the runtime.
298 <hr>
299 ** References
301         <ul>
302                 * RSA Laboratories' <a href="http://www.rsasecurity.com/rsalabs/faq/index.html">
303                 Frequently Asked Questions</a> About Today's Cryptography, Version 4.1
305                 * Public-Key Cryptography Standards (<a href="http://www.rsasecurity.com/rsalabs/pkcs/index.html">
306                 PKCS</a>)
308                 * National Institute of Standards and Technology - Federal 
309                 Information Processing Standards <a href="http://csrc.nist.gov/publications/fips/index.html">
310                 NIST FIPS</a>
311         </ul>
313 <hr>
314 ** How to Help
316         <ul>
317                 * Complete any of the TODO (and feel good about it ;-).
319                 * Analyse the current coverage of the unit tests on the 
320                   cryptographic classes and complete the unit tests. <b><code>
321                   monocov</code> does a great job at this! Now we just need to
322                   complete the missing unit tests.</b>
324                 * Optimization can also be done on most algorithms as crypto 
325                   is never fast enough. Some have been done using the 
326                   Community Edition of BoundChecker (a free VisualStudio 
327                   addon) - recommanded! Just be sure to test every optimization
328                   (using the unit tests) carefully - it's so fast to break an
329                   algorithm ;-).
331                 * Write some documentation or add some sample code for the 
332                   cryptographic classes in <b>monodoc</b>.
333         </ul>
334 <hr>
335 Last reviewed: June 26, 2004 (mono release candidate 1)