3 In the .NET framework cryptography can be found under a number of
4 namespaces in several assemblies.
8 *** Namespace: <b>System.Security.Cryptography</b>
10 Thanks to the work of many people this namespace is almost complete.
14 * Every classes are present.
16 * Most classes have their unit tests. Some tests like <code>
17 SymmetricAlgorithmTest</code> are generated by an external
23 * The current implementation of <code>CryptoStream</code> is
24 very limited and contain known bugs (<a
25 href="http://bugzilla.ximian.com/show_bug.cgi?id=40689">
26 40689</a>). The class need to be re-designed.
28 * Support for adding/modifying OID using the
29 <code>machine.config</code> configuration file (algorithms
32 * RNGCryptoServiceProvider is currently only working on Linux.
33 The current implementation reside in Mono's runtime and use
34 the <code>/dev/[u]random</code> device (which do not exists
35 under Windows). A Windows specific alternative is available
36 using the Mono.Security.Win32 assembly.
38 * Keypair persistance for RSA and DSA. This persistance must
39 somehow be linked with X509 certificate stores (in planning).
41 * <code>PasswordDeriveBytes.CryptDeriveKey</code> is included
42 in MS BCL to provide compatibility with existing Windows
43 applications. The main problem is that the key derivation
44 algorithm can be different for every CSP (Crypto Service
45 Provider). However for compatibility we should provide an
46 implementation compatible with the MS CSP (most likely used).
48 * Analyse the current coverage of the unit tests on the
49 cryptographic classes and complete the unit tests.
51 * Optimizations (performance) on most class are possible. Some
52 have been done using the Community Edition of BoundChecker
53 (a free VisualStudio addon) - recommanded!
58 * All cryptographic algorithms are entirely managed, including
59 classes named <code>*CryptoServiceProvider</code>, with the
60 exception of <code>RNGCryptoServiceProvider</code> (which
61 resides in the runtime).
63 * Look at assembly Mono.Security.Win32 if you require more
64 compatiblity with the Microsoft implementation (like accessing
65 a particuliar keypair container inside a specific CSP).
69 *** Namespace: <b>System.Security.Cryptography.X509Certificates</b>
73 * X.509 certificates are parsed using 100% managed code
74 (using the Mono.Security.ASN1 class).
76 * Software Publisher Certificates (SPC) used by Authenticode
77 (tm) to sign assemblies are supported (extraction from PE
78 files) but <b>not yet</b> validated.
80 * Unit tests are generated from a set of existing certificates
81 (about a dozen) each having different properties. Another
82 set of certificates (more than 300) are used for a more
83 complete test (but isn't part of the standard test suite for
84 size and time consideration, i.e. a 3.5Mb C# source file).
89 * Authenticode(tm) support is incomplete. We can extract the
90 certificates from PE files but cannot validate the signature
91 nor the certificate chain (and we're still missing some trust
92 anchors). See Tools section for more information.
94 * Integration with CryptoAPI (on Windows) isn't possible as
95 long as the <code>X509Certificate(IntPtr)</code> constructor
101 * Except for their structure <b>there are no validation of the
102 certificates</b> done by this class (this is by design and
103 isn't a restriction of Mono!). This means that certificate
104 signatures and validity dates are <b>never</b> checked
105 (except when used for Authenticode, i.e.
106 <code>CreateFromSignedFile</code>).
108 * The newer X509Certificate class included in Microsoft's Web
109 Service Enhancement (WSE) is a little better (as it includes
110 CryptoAPI's validation) when <code>IsCurrent</code> is called.
111 See assembly <b>Microsoft.Web.Services</b> for more details.
113 * The class Mono.Security.X509.X509Certificate (in Mono.Security
114 assembly) is becoming a much better alternative - and will
115 continue to evolve to support the security tools.
117 * Microsoft implementation of <code>X509Certificate</code> is
118 done by using CryptoAPI (unmanaged code). From the exceptions
119 thrown Authenticode(tm) support is done via COM.
123 ** Assembly: System.Security
125 *** Namespace: <b>System.Security.Cryptography.Xml</b>
127 This namespace implements the <a href="http://www.w3.org/TR/xmldsig-core/">
128 XML Digital Signature</a> specification from
129 <a href="http://www.w3.org/">W3C</a>.
133 * All classes are present but some (most Transforms) are only
136 * Most classes have their unit tests.
141 * All the transforms needs to be done. But this requires far
142 more XML knowledge than crypto. Note: Most tests runs because
143 the feeded XML is pre-c14n (by hand in the code) before
144 signing (not because the transforms works). In the short
145 term <code>libxml2</code> could be used to provide C14N, but
146 in the long term a fully managed class would be much better.
150 ** Assembly: Mono.Security
153 This assembly provides the missing pieces to .NET security. On Windows
154 CryptoAPI is often used to provide much needed functionalities (like
155 some cryptographic algorithms, code signing, X.509 certificates).
157 *** Namespace: Mono.Security
159 * Structures (ASN1, PKCS7) and primitives (PKCS1).
161 *** Namespace: Mono.Security.Authenticode
163 * Code signing and verification.
164 * Support for SPC files and PVK files.
166 *** Namespace: Mono.Security.Cryptography
168 * Additional algorithms: MD2, ARCFOUR (required for SSL)
171 *** Namespace: Mono.Security.X509
173 * X.509 certificate building and decoding.
175 *** Namespace: Mono.Security.X509.Extensions
177 * X.509 extensions (from X.509, PKIX, Netsapce, Microsoft,
183 * Some part of the work has not yet been commited (cleaning up).
185 * A big part of this assembly is also included inside Mono's
186 corlib. The class are duplicated in this assembly so the
187 functionalities can be used without a dependency on Mono's
188 corlib (which depends on Mono's runtime).
190 * Unit test coverage isn't (yet) complete.
194 ** Assembly: Mono.Security.Win32
197 This assembly goal is to provide maximum compatibility with CryptoAPI
198 to application running with Mono's runtime on the Windows operating
201 <b>This assembly should NEVER be used directly by any application</b>.
202 The classes should only be used by modifying the <code>machine.config
203 </code> configuration file (and then only if this increased
204 compatibility is required by an application).
206 See the file <code>/mcs/class/Mono.Security.Win32/README</code> for
207 complete instructions.
209 *** Namespace: Mono.Security.Cryptography
213 * A RNGCryptoServiceProvider built on top of CryptoAPI. This
214 allows Windows users to get around the limitation of the
215 runtime RNG (which requires <code>/dev/[u]random/</code>).
217 * Wrapper classes for unmanaged versions of hash algorithms:
218 MD2, MD4, MD5 and SHA1 are supported. <b>note</b>: some
219 algorithms shouldn't be used in new design (MD4 is broken and
220 MD2 isn't considered safe). They are included to preserve
221 interoperability with older applications (e.g. some old, but
222 still valid, X.509 certificates use MD2).
227 * Wrapper classes for unmanaged versions of symmetric
228 encryption algorithms (like DES, TripleDES, RC2 and others
229 present in default CSP).
231 * Wrapper classes for unmanaged versions of asymmetric
232 algorithms (like DSA and RSA) which persist their keypair
233 into the specified CSP.
238 * Similar assembly could be created for <a href="http://www.openssl.org">
239 OpenSSL</a>, NSS, crypto++, cryptlib ... for improved
240 performance and/or HSM support under Linux.
243 ** Assembly: Microsoft.Web.Services
245 Microsoft Web Service Enhancement (WSE), known as Web Service
246 Development Kit (WSDK) in it's beta days, is an add-on the .NET
247 framework that implements WS-Security (and other WS-* specifications).
248 It also includes improved support for XML Signature (replacing and/or
249 extending <code>System.Security.Cryptography.Xml</code>) and X.509
250 certificates classes.
252 Note: WSE is distributed as an add-on because some specifications,
253 like WS-Security, aren't yet completed by
254 <a href="http://www.oasis-open.org/committees/wss/">OASIS</a> or
257 <b>[*] There are some licensing issues to consider before stating to
258 implement WS-Security. All contributors must sign an agreement with
259 Microsoft before commiting anything related to WS-Security into CVS.
262 *** Namespace: Microsoft.Web.Services.Security [*]
263 *** Namespace: Microsoft.Web.Services.Timestamp [*]
267 * Nothing (yet) commited in CVS <b>[*]</b>.
270 *** Namespace: Microsoft.Web.Services.Security.X509
274 * Nothing (yet) commited in CVS. However the classes in this
275 namespace are outside WS-Security scope. So development, for
276 those, could be done without signing any agreements.
281 * We need to define certificate stores (for both users and
282 machines). These sames stores must be linked with asymmetric
283 keypairs. This could also be used to store the SPC roots.
289 There are many tools in the .NET framework that indirectly interacts
290 with some cryptographic classes. Mono will eventually need these tools.
291 Unless noted the tools should work on any CLR (tested with both Mono
296 The following tools are complete:
298 * <code>secutil</code> is a tool to extract certificates and
299 strongnames from assemblies in a format that can be easily
300 re-used in source code (C# or VB.NET syntax).
302 * <code>cert2spc</code> is a tool to transform multiple X.509
303 certificates and CRLs into a Software Publisher Certificate
304 (SPC) file - which is a long name for a simple PKCS#7 file.
306 * <code>makecert</code> to create X.509 test certificates that
307 can be used (once transformed in SPC) to sign assemblies.
311 The following tools are still missing or incomplete:
313 * <code>monosn</code> is a clone of the <code>sn</code> to manage
314 strongnames. This tools is part of the runtime (not the class
315 library) and as such is written in C and won't run without Mono.
317 * <code>signcode</code> and <code>chktrust</code> (in progress)
318 for signing and validating Authenticode(tm) signatures on
319 assemblies (or any PE file).
321 * Other tools like a, GUI-based, certificate manager...
324 Note that many of the tools requires the class library and/or the
325 runtime to be ready for them. E.g. StrongName and Authenticode signatures
326 tools are of limited use until supported by the runtime.
332 * SSL/TLS for secure communication (a prototype is under way).
333 Some work is already visible in Mono.Security assembly (e.g.
341 Complete any of the TODO (and feel good about it ;-).
343 Add missing unit tests to classes or methods.
345 Write some documentation on the cryptographic classes for the
346 <a href="http://go-mono.com/tutorial/html/en/index.html">Mono
347 Handbook</a> as I'm not a very good writer (at least in English).
349 Optimization can also be done on algorithms as crypto is never fast
350 enough. Just be sure to test every optimization (using the unit test)
351 carefully - it's so fast to break an algorithm ;-).
353 Contact Sebastien Pouliot (<a href="mailto:spouliot@videotron.ca">home</a>
354 , <a href="mailto:spouliot@motus.com">work</a>) if you need additional
355 informations about the status of the cryptographic classes.
358 Last reviewed: April 7, 2003 (post mono 0.23)