2 // CryptoConfigTest.cs - NUnit Test Cases for CryptoConfig
5 // Sebastien Pouliot <sebastien@ximian.com>
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
8 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using NUnit.Framework;
32 using System.Security.Cryptography;
34 namespace MonoTests.System.Security.Cryptography {
37 public class CryptoConfigTest {
39 void CreateFromName (string name, string objectname)
41 object o = CryptoConfig.CreateFromName (name);
42 if (objectname == null)
43 Assert.IsNull (o, name);
45 Assert.AreEqual (objectname, o.ToString (), name);
49 [ExpectedException (typeof (ArgumentNullException))]
50 public void CreateFromNameNull ()
52 object o = CryptoConfig.CreateFromName (null);
55 // validate that CryptoConfig create the exact same implementation between mono and MS
57 public void CreateFromName ()
59 CreateFromName ("SHA", "System.Security.Cryptography.SHA1CryptoServiceProvider");
60 // FIXME: We need to support the machine.config file to get exact same results
61 // with the MS .NET Framework
62 CreateFromName ("SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
63 CreateFromName( "System.Security.Cryptography.SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
64 // after installing the WSDK - changes to the machine.config file (not documented)
65 // CreateFromName ("SHA1", "System.Security.Cryptography.SHA1Managed");
66 // CreateFromName ("System.Security.Cryptography.SHA1", "System.Security.Cryptography.SHA1Managed");
67 CreateFromName ("System.Security.Cryptography.HashAlgorithm", "System.Security.Cryptography.SHA1CryptoServiceProvider");
68 CreateFromName ("System.Security.Cryptography.SHA1CryptoServiceProvider", "System.Security.Cryptography.SHA1CryptoServiceProvider");
69 CreateFromName ("MD5", "System.Security.Cryptography.MD5CryptoServiceProvider");
70 CreateFromName ("System.Security.Cryptography.MD5", "System.Security.Cryptography.MD5CryptoServiceProvider");
71 CreateFromName ("System.Security.Cryptography.MD5CryptoServiceProvider", "System.Security.Cryptography.MD5CryptoServiceProvider");
72 CreateFromName ("SHA256", "System.Security.Cryptography.SHA256Managed");
73 CreateFromName ("SHA-256", "System.Security.Cryptography.SHA256Managed");
74 CreateFromName ("System.Security.Cryptography.SHA256", "System.Security.Cryptography.SHA256Managed");
75 CreateFromName ("SHA384", "System.Security.Cryptography.SHA384Managed");
76 CreateFromName ("SHA-384", "System.Security.Cryptography.SHA384Managed");
77 CreateFromName ("System.Security.Cryptography.SHA384", "System.Security.Cryptography.SHA384Managed");
78 CreateFromName ("SHA512", "System.Security.Cryptography.SHA512Managed");
79 CreateFromName ("SHA-512", "System.Security.Cryptography.SHA512Managed");
80 CreateFromName ("System.Security.Cryptography.SHA512", "System.Security.Cryptography.SHA512Managed");
81 CreateFromName ("RSA", "System.Security.Cryptography.RSACryptoServiceProvider");
82 CreateFromName ("System.Security.Cryptography.RSA", "System.Security.Cryptography.RSACryptoServiceProvider");
83 CreateFromName ("System.Security.Cryptography.AsymmetricAlgorithm", "System.Security.Cryptography.RSACryptoServiceProvider");
84 CreateFromName ("DSA", "System.Security.Cryptography.DSACryptoServiceProvider");
85 CreateFromName ("System.Security.Cryptography.DSA", "System.Security.Cryptography.DSACryptoServiceProvider");
86 CreateFromName ("DES", "System.Security.Cryptography.DESCryptoServiceProvider");
87 CreateFromName ("System.Security.Cryptography.DES", "System.Security.Cryptography.DESCryptoServiceProvider");
88 CreateFromName ("3DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
89 CreateFromName ("TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
90 CreateFromName ("Triple DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
91 CreateFromName ("System.Security.Cryptography.TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
92 // LAMESPEC SymmetricAlgorithm documented as TripleDESCryptoServiceProvider
93 CreateFromName ("System.Security.Cryptography.SymmetricAlgorithm", "System.Security.Cryptography.RijndaelManaged");
94 CreateFromName ("RC2", "System.Security.Cryptography.RC2CryptoServiceProvider");
95 CreateFromName ("System.Security.Cryptography.RC2", "System.Security.Cryptography.RC2CryptoServiceProvider");
96 CreateFromName ("Rijndael", "System.Security.Cryptography.RijndaelManaged");
97 CreateFromName ("System.Security.Cryptography.Rijndael", "System.Security.Cryptography.RijndaelManaged");
98 // LAMESPEC Undocumented Names in CryptoConfig
99 CreateFromName ("RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider");
100 CreateFromName ("System.Security.Cryptography.RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider");
101 CreateFromName ("System.Security.Cryptography.KeyedHashAlgorithm", "System.Security.Cryptography.HMACSHA1");
102 CreateFromName ("HMACSHA1", "System.Security.Cryptography.HMACSHA1");
103 CreateFromName ("System.Security.Cryptography.HMACSHA1", "System.Security.Cryptography.HMACSHA1");
104 CreateFromName ("MACTripleDES", "System.Security.Cryptography.MACTripleDES");
105 CreateFromName ("System.Security.Cryptography.MACTripleDES", "System.Security.Cryptography.MACTripleDES");
107 // new HMAC - new base class doesn't return anything with it's short name
\r
108 Assert.IsNull (CryptoConfig.CreateFromName ("HMAC"), "HMAC");
109 CreateFromName ("System.Security.Cryptography.HMAC", "System.Security.Cryptography.HMACSHA1");
\r
110 CreateFromName ("HMACMD5", "System.Security.Cryptography.HMACMD5");
\r
111 CreateFromName ("System.Security.Cryptography.HMACMD5", "System.Security.Cryptography.HMACMD5");
\r
112 CreateFromName ("HMACRIPEMD160", "System.Security.Cryptography.HMACRIPEMD160");
\r
113 CreateFromName ("System.Security.Cryptography.HMACRIPEMD160", "System.Security.Cryptography.HMACRIPEMD160");
\r
114 CreateFromName ("HMACSHA256", "System.Security.Cryptography.HMACSHA256");
\r
115 CreateFromName ("System.Security.Cryptography.HMACSHA256", "System.Security.Cryptography.HMACSHA256");
\r
116 CreateFromName ("HMACSHA384", "System.Security.Cryptography.HMACSHA384");
\r
117 CreateFromName ("System.Security.Cryptography.HMACSHA384", "System.Security.Cryptography.HMACSHA384");
\r
118 CreateFromName ("HMACSHA512", "System.Security.Cryptography.HMACSHA512");
\r
119 CreateFromName ("System.Security.Cryptography.HMACSHA512", "System.Security.Cryptography.HMACSHA512");
\r
120 // new hash algorithm
\r
121 CreateFromName ("RIPEMD160", "System.Security.Cryptography.RIPEMD160Managed");
\r
122 CreateFromName ("RIPEMD-160", "System.Security.Cryptography.RIPEMD160Managed");
\r
123 CreateFromName ("System.Security.Cryptography.RIPEMD160", "System.Security.Cryptography.RIPEMD160Managed");
\r
125 // note: CryptoConfig can create any object !
126 CreateFromName ("System.Security.Cryptography.CryptoConfig", "System.Security.Cryptography.CryptoConfig");
127 CreateFromName ("System.IO.MemoryStream", "System.IO.MemoryStream");
128 // non existing algo should return null (without exception)
\r
129 Assert.IsNull (CryptoConfig.CreateFromName ("NonExistingAlgorithm"), "NonExistingAlgorithm");
132 // additional names (URL) used for XMLDSIG (System.Security.Cryptography.Xml)
133 // URL taken from http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/
135 public void CreateFromURL ()
137 // URL used in SignatureMethod element
138 CreateFromName ("http://www.w3.org/2000/09/xmldsig#dsa-sha1", "System.Security.Cryptography.DSASignatureDescription");
139 CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription");
140 CreateFromName ("http://www.w3.org/2000/09/xmldsig#hmac-sha1", null);
141 // URL used in DigestMethod element
142 CreateFromName ("http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
143 // URL used in Canonicalization or Transform elements
144 CreateFromName ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315", "System.Security.Cryptography.Xml.XmlDsigC14NTransform");
145 CreateFromName ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", "System.Security.Cryptography.Xml.XmlDsigC14NWithCommentsTransform");
146 // URL used in Transform element
147 CreateFromName ("http://www.w3.org/2000/09/xmldsig#base64", "System.Security.Cryptography.Xml.XmlDsigBase64Transform");
148 // after installing the WSDK - changes to the machine.config file (not documented)
149 // CreateFromName ("http://www.w3.org/TR/1999/REC-xpath-19991116", "Microsoft.WSDK.Security.XmlDsigXPathTransform");
150 CreateFromName ("http://www.w3.org/TR/1999/REC-xpath-19991116", "System.Security.Cryptography.Xml.XmlDsigXPathTransform");
151 CreateFromName ("http://www.w3.org/TR/1999/REC-xslt-19991116", "System.Security.Cryptography.Xml.XmlDsigXsltTransform");
152 CreateFromName ("http://www.w3.org/2000/09/xmldsig#enveloped-signature", "System.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform");
153 // URL used in Reference element
154 CreateFromName ("http://www.w3.org/2000/09/xmldsig#Object", null);
155 CreateFromName ("http://www.w3.org/2000/09/xmldsig#Manifest", null);
156 CreateFromName ("http://www.w3.org/2000/09/xmldsig#SignatureProperties", null);
157 // LAMESPEC: only documentated in ".NET Framework Security" book
158 CreateFromName ("http://www.w3.org/2000/09/xmldsig# X509Data", "System.Security.Cryptography.Xml.KeyInfoX509Data");
159 CreateFromName ("http://www.w3.org/2000/09/xmldsig# KeyName", "System.Security.Cryptography.Xml.KeyInfoName");
160 CreateFromName ("http://www.w3.org/2000/09/xmldsig# KeyValue/DSAKeyValue", "System.Security.Cryptography.Xml.DSAKeyValue");
161 CreateFromName ("http://www.w3.org/2000/09/xmldsig# KeyValue/RSAKeyValue", "System.Security.Cryptography.Xml.RSAKeyValue");
162 CreateFromName ("http://www.w3.org/2000/09/xmldsig# RetrievalMethod", "System.Security.Cryptography.Xml.KeyInfoRetrievalMethod");
166 public void CreateFromName_UpperCase ()
168 CreateFromName ("SHA", "System.Security.Cryptography.SHA1CryptoServiceProvider");
169 CreateFromName ("SYSTEM.SECURITY.CRYPTOGRAPHY.TRIPLEDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
170 CreateFromName ("HTTP://WWW.W3.ORG/2000/09/XMLDSIG#DSA-SHA1", "System.Security.Cryptography.DSASignatureDescription");
174 public void CreateFromName_LowerCase ()
176 CreateFromName ("sha", "System.Security.Cryptography.SHA1CryptoServiceProvider");
177 CreateFromName ("system.security.cryptography.tripledes", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
178 CreateFromName ("http://www.w3.org/2000/09/xmldsig#dsa-sha1", "System.Security.Cryptography.DSASignatureDescription");
182 public void CreateFromName_MixedCase ()
184 CreateFromName ("ShA", "System.Security.Cryptography.SHA1CryptoServiceProvider");
185 CreateFromName ("SyStEm.SeCuRiTy.CrYpToGrApHy.TrIpLeDeS", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
186 CreateFromName ("hTtP://wWw.W3.oRg/2000/09/xMlDsIg#dSa-sHa1", "System.Security.Cryptography.DSASignatureDescription");
189 // Tests created using "A Layer Man Guide to ASN.1" from RSA, page 19-20
190 // Need to find an OID ? goto http://www.alvestrand.no/~hta/objectid/top.html
191 static byte[] oidETSI = { 0x06, 0x03, 0x04, 0x00, 0x00 };
192 static byte[] oidSHA1 = { 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A };
193 static byte[] oidASN1CharacterModule = { 0x06, 0x04, 0x51, 0x00, 0x00, 0x00 };
194 static byte[] oidmd5withRSAEncryption = { 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04 };
198 [ExpectedException (typeof (ArgumentNullException))]
200 [ExpectedException (typeof (NullReferenceException))]
202 public void EncodeOIDNull ()
204 byte[] o = CryptoConfig.EncodeOID (null);
208 public void EncodeOID ()
210 // OID starts with 0, 1 or 2
\r
211 Assert.AreEqual (oidETSI, CryptoConfig.EncodeOID ("0.4.0.0"), "OID starting with 0.");
\r
212 Assert.AreEqual (oidSHA1, CryptoConfig.EncodeOID ("1.3.14.3.2.26"), "OID starting with 1.");
\r
213 Assert.AreEqual (oidASN1CharacterModule, CryptoConfig.EncodeOID ("2.1.0.0.0"), "OID starting with 2.");
214 // OID numbers can span multiple bytes
\r
215 Assert.AreEqual (oidmd5withRSAEncryption, CryptoConfig.EncodeOID ("1.2.840.113549.1.1.4"), "OID with numbers spanning multiple bytes");
219 [ExpectedException (typeof (CryptographicUnexpectedOperationException))]
220 // LAMESPEC: OID greater that 0x7F (127) bytes aren't supported by the MS Framework
221 public void EncodeOID_BiggerThan127bytes ()
223 // "ms"-invalid OID - greater than 127 bytes (length encoding)
224 // OID longer than 127 bytes (so length must be encoded on multiple bytes)
225 string baseOID = "1.3.6.1.4.1.11071.0.";
226 string lastPart = "1111111111"; // must fit in int32
227 for (int i = 1; i < 30; i++) {
228 baseOID += lastPart + ".";
231 byte[] tooLongOID = CryptoConfig.EncodeOID (baseOID);
235 [ExpectedException (typeof (OverflowException))]
236 // LAMESPEC: OID with numbers > Int32 aren't supported by the MS BCL
237 public void EncodeOID_BiggerThanInt32 ()
239 // "ms"-invalid OID - where a number of the OID > Int32
240 byte[] tooLongOID = CryptoConfig.EncodeOID ("1.1.4294967295");
244 public void EncodeOID_InvalidStart ()
246 // invalid OID - must start with 0, 1 or 2
247 // however it works with MS BCL
248 byte[] oid3 = CryptoConfig.EncodeOID ("3.0");
249 byte[] res3 = { 0x06, 0x01, 0x78 };
\r
250 Assert.AreEqual (res3, oid3, "OID: 3.0");
254 [ExpectedException (typeof (CryptographicUnexpectedOperationException))]
255 public void EncodeOID_TooShort ()
257 // invalid OID - must have at least 2 parts (according to X.208)
258 byte[] tooShortOID = CryptoConfig.EncodeOID ("0");
262 public void EncodeOID_InvalidSecondPart ()
264 // invalid OID - second value < 40 for 0. and 1. (modulo 40)
265 // however it works with MS BCL
266 byte[] tooBigSecondPartOID = CryptoConfig.EncodeOID ("0.40");
267 byte[] tooBigSecondPartRes = { 0x06, 0x01, 0x28 };
\r
268 Assert.AreEqual (tooBigSecondPartRes, tooBigSecondPartOID, "OID: 0.40");
272 [ExpectedException (typeof (ArgumentNullException))]
273 public void MapNameToOIDNull ()
275 CryptoConfig.MapNameToOID (null);
278 private void MapNameToOID (string name, string oid)
280 Assert.AreEqual (oid, CryptoConfig.MapNameToOID (name), "oid(" + name + ")");
283 // LAMESPEC: doesn't support all names defined in CryptoConfig
284 // non supported names (in MSFW) are commented or null-ed
285 // LAMESPEC: undocumented but full class name is supported
287 public void MapNameToOID()
289 // MapNameToOID ("SHA", "1.3.14.3.2.26");
290 MapNameToOID ("SHA1", "1.3.14.3.2.26");
291 MapNameToOID ("System.Security.Cryptography.SHA1", "1.3.14.3.2.26");
292 // MapNameToOID ("System.Security.Cryptography.HashAlgorithm", "1.3.14.3.2.26");
293 MapNameToOID ("System.Security.Cryptography.SHA1CryptoServiceProvider", "1.3.14.3.2.26");
294 MapNameToOID ("System.Security.Cryptography.SHA1Managed", "1.3.14.3.2.26");
295 MapNameToOID ("MD5", "1.2.840.113549.2.5");
296 MapNameToOID ("System.Security.Cryptography.MD5", "1.2.840.113549.2.5");
297 MapNameToOID ("System.Security.Cryptography.MD5CryptoServiceProvider", "1.2.840.113549.2.5");
299 MapNameToOID ("SHA256", "2.16.840.1.101.3.4.2.1");
300 MapNameToOID ("System.Security.Cryptography.SHA256", "2.16.840.1.101.3.4.2.1");
301 MapNameToOID ("System.Security.Cryptography.SHA256Managed", "2.16.840.1.101.3.4.2.1");
302 MapNameToOID ("SHA384", "2.16.840.1.101.3.4.2.2");
303 MapNameToOID ("System.Security.Cryptography.SHA384", "2.16.840.1.101.3.4.2.2");
304 MapNameToOID ("System.Security.Cryptography.SHA384Managed", "2.16.840.1.101.3.4.2.2");
305 MapNameToOID ("SHA512", "2.16.840.1.101.3.4.2.3");
306 MapNameToOID ("System.Security.Cryptography.SHA512", "2.16.840.1.101.3.4.2.3");
307 MapNameToOID ("System.Security.Cryptography.SHA512Managed", "2.16.840.1.101.3.4.2.3");
309 MapNameToOID ("SHA256", "2.16.840.1.101.3.4.1");
310 // MapNameToOID ("SHA-256", "2.16.840.1.101.3.4.1");
311 MapNameToOID ("System.Security.Cryptography.SHA256", "2.16.840.1.101.3.4.1");
312 MapNameToOID ("System.Security.Cryptography.SHA256Managed", "2.16.840.1.101.3.4.1");
313 MapNameToOID ("SHA384", "2.16.840.1.101.3.4.2");
314 // MapNameToOID ("SHA-384", "2.16.840.1.101.3.4.2");
315 MapNameToOID ("System.Security.Cryptography.SHA384", "2.16.840.1.101.3.4.2");
316 MapNameToOID ("System.Security.Cryptography.SHA384Managed", "2.16.840.1.101.3.4.2");
317 MapNameToOID ("SHA512", "2.16.840.1.101.3.4.3");
318 // MapNameToOID ("SHA-512", "2.16.840.1.101.3.4.3");
319 MapNameToOID ("System.Security.Cryptography.SHA512", "2.16.840.1.101.3.4.3");
320 MapNameToOID ("System.Security.Cryptography.SHA512Managed", "2.16.840.1.101.3.4.3");
322 // LAMESPEC: only documentated in ".NET Framework Security" book
323 MapNameToOID ("TripleDESKeyWrap", "1.2.840.113549.1.9.16.3.6");
325 // new OID defined in Fx 2.0
326 MapNameToOID ("DES", "1.3.14.3.2.7");
327 MapNameToOID ("TripleDES", "1.2.840.113549.3.7");
328 MapNameToOID ("RC2", "1.2.840.113549.3.2");
330 // no OID defined before Fx 2.0
331 MapNameToOID ("DES", null);
332 MapNameToOID ("TripleDES", null);
333 MapNameToOID ("RC2", null);
335 MapNameToOID ("RSA", null);
336 MapNameToOID ("DSA", null);
337 MapNameToOID ("3DES", null);
339 MapNameToOID ("System.Security.Cryptography.RSA", null);
340 MapNameToOID ("System.Security.Cryptography.AsymmetricAlgorithm", null);
341 MapNameToOID ("System.Security.Cryptography.DSA", null);
342 MapNameToOID ("System.Security.Cryptography.DES", null);
343 MapNameToOID ("Triple DES", null);
344 MapNameToOID ("System.Security.Cryptography.TripleDES", null);
345 MapNameToOID ("System.Security.Cryptography.RC2", null);
346 MapNameToOID ("Rijndael", null);
347 MapNameToOID ("System.Security.Cryptography.Rijndael", null);
348 MapNameToOID ("System.Security.Cryptography.SymmetricAlgorithm", null);
349 // LAMESPEC Undocumented Names in CryptoConfig
350 MapNameToOID ("RandomNumberGenerator", null);
351 MapNameToOID ("System.Security.Cryptography.RandomNumberGenerator", null);
352 MapNameToOID ("System.Security.Cryptography.KeyedHashAlgorithm", null);
354 MapNameToOID ("HMAC", null);
\r
355 MapNameToOID ("System.Security.Cryptography.HMAC", null);
\r
356 MapNameToOID ("HMACMD5", null);
\r
357 MapNameToOID ("System.Security.Cryptography.HMACMD5", null);
\r
358 MapNameToOID ("HMACRIPEMD160", null);
\r
359 MapNameToOID ("System.Security.Cryptography.HMACRIPEMD160", null);
\r
360 MapNameToOID ("HMACSHA256", null);
\r
361 MapNameToOID ("System.Security.Cryptography.HMACSHA256", null);
\r
362 MapNameToOID ("HMACSHA384", null);
\r
363 MapNameToOID ("System.Security.Cryptography.HMACSHA384", null);
\r
364 MapNameToOID ("HMACSHA512", null);
\r
365 MapNameToOID ("System.Security.Cryptography.HMACSHA512", null);
\r
367 MapNameToOID ("HMACSHA1", null);
\r
368 MapNameToOID ("System.Security.Cryptography.HMACSHA1", null);
\r
369 MapNameToOID ("MACTripleDES", null);
370 MapNameToOID ("System.Security.Cryptography.MACTripleDES", null);
371 // non existing algo should return null (without exception)
372 MapNameToOID ("NonExistingAlgorithm", null);
376 public void MapNameToOID_UpperCase ()
378 MapNameToOID ("SHA1", "1.3.14.3.2.26");
379 MapNameToOID ("SYSTEM.SECURITY.CRYPTOGRAPHY.MD5CRYPTOSERVICEPROVIDER", "1.2.840.113549.2.5");
383 public void MapNameToOID_LowerCase ()
385 MapNameToOID ("sha1", "1.3.14.3.2.26");
386 MapNameToOID ("system.security.cryptography.md5cryptoserviceprovider", "1.2.840.113549.2.5");
390 public void MapNameToOID_MixedCase ()
392 MapNameToOID ("sHa1", "1.3.14.3.2.26");
393 MapNameToOID ("SySteM.SeCuRiTy.CrYpToGrApHy.Md5cRyPtOsErViCePrOvIdEr", "1.2.840.113549.2.5");
397 public void CCToString ()
399 // under normal circumstance there are no need to create a CryptoConfig object
400 // because all interesting stuff are in static methods
401 CryptoConfig cc = new CryptoConfig ();
402 Assert.AreEqual ("System.Security.Cryptography.CryptoConfig", cc.ToString ());