// // RSAManagedTest.cs: NUnit Test Cases for RSAManaged // - based on RSACryptoServiceProviderTest // // Author: // Sebastien Pouliot // // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) // Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using NUnit.Framework; using System; using System.IO; using System.Security.Cryptography; using Mono.Security.Cryptography; namespace MonoTests.Mono.Security.Cryptography { [TestFixture] public class RSAManagedTest { static int minKeySize = 384; [Test] public void ConstructorEmpty () { // under Mono:: a new key pair isn't generated RSAManaged rsa = new RSAManaged (); // test default key size Assert.AreEqual (1024, rsa.KeySize, "Default key size"); } [Test] public void ConstructorKeySize () { RSAManaged rsa = new RSAManaged (minKeySize); // test default key size Assert.AreEqual (minKeySize, rsa.KeySize, "Minimum key size"); } [Test] [ExpectedException (typeof (CryptographicException))] public void TooSmallKeyPair () { RSAManaged rsa = new RSAManaged (256); } [Test] [ExpectedException (typeof (CryptographicException))] public void TooBigKeyPair () { RSAManaged rsa = new RSAManaged (32768); } [Test] public void Properties () { RSAManaged rsa = new RSAManaged (minKeySize); Assert.AreEqual (1, rsa.LegalKeySizes.Length, "LegalKeySize"); Assert.AreEqual (minKeySize, rsa.LegalKeySizes [0].MinSize, "LegalKeySize.MinSize"); Assert.AreEqual (16384, rsa.LegalKeySizes [0].MaxSize, "LegalKeySize.MaxSize"); Assert.AreEqual (8, rsa.LegalKeySizes [0].SkipSize, "LegalKeySize.SkipSize"); Assert.AreEqual ("RSA-PKCS1-KeyEx", rsa.KeyExchangeAlgorithm, "KeyExchangeAlgorithm"); Assert.AreEqual ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", rsa.SignatureAlgorithm, "SignatureAlgorithm"); rsa.Clear (); Assert.AreEqual (1, rsa.LegalKeySizes.Length, "LegalKeySize(disposed)"); Assert.AreEqual (minKeySize, rsa.LegalKeySizes [0].MinSize, "LegalKeySize.MinSize(disposed)"); Assert.AreEqual (16384, rsa.LegalKeySizes [0].MaxSize, "LegalKeySize.MaxSize(disposed)"); Assert.AreEqual (8, rsa.LegalKeySizes [0].SkipSize, "LegalKeySize.SkipSize(disposed)"); Assert.AreEqual ("RSA-PKCS1-KeyEx", rsa.KeyExchangeAlgorithm, "KeyExchangeAlgorithm(disposed)"); Assert.AreEqual ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", rsa.SignatureAlgorithm, "SignatureAlgorithm(disposed)"); } // all keypairs generated by CryptoAPI on Windows string CapiXml384 = "vWi7cHIntTcrwIoD0zj/fxoJCDfUHtC5xkMe8pJri7G+T6nKs4zRcLDWRDA0cNhfAQAB

5DwRzr4EPAk1NOUSwI/z1yBJzG2EyrhR

1HOEBwbXvsrPQvV7C0MWtHJ22UWgwgmvqQrEtbePM1gujErOJMl59O/5OOw02mDBbUFGqXJsavLTaaTidSU4PO4MjqnPBVqDY+XUwMmlI2G63reScAyc9PHvTPX2fwCgo1Ku5cwZf0IegPzBRZ5NeYy6oxJ430V8n4BLZ8G8/N6kRHnXe70OyzwAylPtxjGh
"; string CapiXml448 = "slPik6EfNCiN2MwhF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a line for Visual Studio) // same keypairs but without CRT string CapiXml384woCRT = "vWi7cHIntTcrwIoD0zj/fxoJCDfUHtC5xkMe8pJri7G+T6nKs4zRcLDWRDA0cNhfAQABo1Ku5cwZf0IegPzBRZ5NeYy6oxJ430V8n4BLZ8G8/N6kRHnXe70OyzwAylPtxjGh"; string CapiXml448woCRT = "slPik6EfNCiN2MwhFHngEOqqRlSXeBjmKoLyMVgLCPIQJQqe/BMcyA1gQg4mgionngIgXCMuSOU=AQABUTV8SEimoiUZu7HyGpYJ4QpMsqyRMgL8xj1Nt0JLKBObONObUBEPAPQKknuE98cM9j/2ufRlrx0="; string CapiXml512woCRT = "0ci216d7QTTKkh2Zknwbqlp/Eva1IfzzIA6JZKSI4lcYWMWKAadU7cJtJ5JKGe1aeMi3Y1CDWCpr8fUL28QEkQ==AQABi+23mA0Mt6fA3smDoCPMSEroq/uHQk541Q8dMdZVv7JmKBJKk1PCppwISyv7fWKVmRTsnGuEnxZFl4N9IR/qyQ=="; string CapiXml576woCRT = "si995MicOWrr2/VlH1rUAhyFMPVLj5PvYHU8P8I8R77kh1ePn66zuJ0jRsMCpenUzYGuVtqgn0VDjiaYjo7cE2PZYESLkKJlAQABQZ9L9h4Lqvm9s1xEya9htQVb6BPuqAoLdrK2ZaTbHnEnKNEN7oLMr1Ca5zh/E6xXKCmwClWyULeKiYq7vYLUXhaemtT1rN9h"; string CapiXml640woCRT = "vqS9CNxiRdSc6x3nJOWnPi7gVA4Vsnhd8cTAaMBKuvI0FRhhDsTRsjr8PeH4Y7yMg8XSucr3I8jkYgapBW8s5hmSvdWZhPHRGEe1MiEIeMM=AQABJhKALeTVO1zaeZnfL18tpx11b1PgwWOIX2ALjN/aDLuR6ySTPX/Q4I6zBOzVa/KB6VMNNk4abIKUvOp6MBNYIMRMK8veaIJxYrn+JAOShwE="; string CapiXml704woCRT = "wbclY53TAIx2E6uPkYeYNVFPYnHgLDJGO1ZoSQcUm6ccySsJvVWAP9TWLIOTjJh2zaQn5gore87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Nd2iLaJw9l6CtV/x4C68u+2nCoBq/Gv/ht9RqYRS6ODUTk1aOL1mPNSHT/MeFNK+06lyQNSaf95fMxGPIcnnJ1vtdkHgk2vi5ALSQf5tGIgVY1EFr55M9ABTg1p98XwIQgjIxCZcL4BygfMk1YbESaQFvzth"; string CapiXml2048woCRT = "9TFEYeTahPGOXtcRZrLQu1gHm875jv1jgxy0R9V3E/vDyEhNbsRK76rvEs3ljw6spQBQE1zd5wfUvFnhVETOuS0z9aXSAljxSIbyhkL/jT7/4vHEHe/GnBQZPdvJ9PtPr0ssLROy8xcsUEBDwxNRPNHSpmub3FHZzHsoMlJV0cOGmn0qqeMuMrP8zVDycXhXZNsn8v5RPC38qk6VDHdCqGz/90IRYonpFr5my9LaguJHVNCq8BRVa1oJkDtNUFhFXjVHnmxmhS9Mqm2obEpTp/jUk+bRqnygKB3up9OGYdLO1rAv2IoH/K2sxcvnedDzieRmPE/9Y9JBP/UvM+VULw==AQABao8oyuqs1U4ts6YAWAOql2DgnaRL7QrObrLQ3s802yh1o9tYW6VPc+1zzVZSR+P2wBbsth2MCtXqbJkbRoZI2U194WpZZM/GvOB5EkSXz4jrqHOt6dzFEhviBHI6yQ9XSDWBU23WPbN6fL4RNPx2N9pwlAb8S7n+z9FOXOBPj8NyMMtykGqgPyHEAQnuhfLuf/J6OGrHX8dzsZAo6o/bnk49Rv0C6nijE74TeAwJ36UuI9Lw+h6hwtSerEN6o1vy6mIjrjdDM07mKKUMFwkEhKJc6ckBb0xVp/3VRlJb1ocYQHbfjCAPjecR8OVfjaIy9WPMj8WXHegJpiBugWK9wQ=="; // import/export XML keypairs // so we know that Mono can use keypairs generated by CryptoAPI [Test] public void CapiXmlImportExport () { RSAManaged rsa = new RSAManaged (); rsa.FromXmlString (CapiXml384); Assert.AreEqual (CapiXml384, rsa.ToXmlString (true), "Capi-Xml384"); rsa.FromXmlString (CapiXml448); Assert.AreEqual (CapiXml448, rsa.ToXmlString (true), "Capi-Xml448"); rsa.FromXmlString (CapiXml512); Assert.AreEqual (CapiXml512, rsa.ToXmlString (true), "Capi-Xml512"); rsa.FromXmlString (CapiXml576); Assert.AreEqual (CapiXml576, rsa.ToXmlString (true), "Capi-Xml576"); rsa.FromXmlString (CapiXml640); Assert.AreEqual (CapiXml640, rsa.ToXmlString (true), "Capi-Xml640"); rsa.FromXmlString (CapiXml704); Assert.AreEqual (CapiXml704, rsa.ToXmlString (true), "Capi-Xml704"); rsa.FromXmlString (CapiXml768); Assert.AreEqual (CapiXml768, rsa.ToXmlString (true), "Capi-Xml768"); rsa.FromXmlString (CapiXml832); Assert.AreEqual (CapiXml832, rsa.ToXmlString (true), "Capi-Xml832"); rsa.FromXmlString (CapiXml896); Assert.AreEqual (CapiXml896, rsa.ToXmlString (true), "Capi-Xml896"); rsa.FromXmlString (CapiXml960); Assert.AreEqual (CapiXml960, rsa.ToXmlString (true), "Capi-Xml960"); rsa.FromXmlString (CapiXml1024); Assert.AreEqual (CapiXml1024, rsa.ToXmlString (true), "Capi-Xml1024"); rsa.FromXmlString (CapiXml1536); Assert.AreEqual (CapiXml1536, rsa.ToXmlString (true), "Capi-Xml1536"); rsa.FromXmlString (CapiXml2048); Assert.AreEqual (CapiXml2048, rsa.ToXmlString (true), "Capi-Xml2048"); } [Test] public void CapiXmlImportWithoutCRT () { RSAManaged rsa = new RSAManaged (); rsa.FromXmlString (CapiXml384woCRT); Assert.AreEqual (CapiXml384woCRT, rsa.ToXmlString (true), "Capi-Xml384-WithoutCRT"); rsa.FromXmlString (CapiXml448woCRT); Assert.AreEqual (CapiXml448woCRT, rsa.ToXmlString (true), "Capi-Xml448-WithoutCRT"); rsa.FromXmlString (CapiXml512woCRT); Assert.AreEqual (CapiXml512woCRT, rsa.ToXmlString (true), "Capi-Xml512-WithoutCRT"); rsa.FromXmlString (CapiXml576woCRT); Assert.AreEqual (CapiXml576woCRT, rsa.ToXmlString (true), "Capi-Xml576-WithoutCRT"); rsa.FromXmlString (CapiXml640woCRT); Assert.AreEqual (CapiXml640woCRT, rsa.ToXmlString (true), "Capi-Xml640-WithoutCRT"); rsa.FromXmlString (CapiXml704woCRT); Assert.AreEqual (CapiXml704woCRT, rsa.ToXmlString (true), "Capi-Xml704-WithoutCRT"); rsa.FromXmlString (CapiXml768woCRT); Assert.AreEqual (CapiXml768woCRT, rsa.ToXmlString (true), "Capi-Xml768-WithoutCRT"); rsa.FromXmlString (CapiXml832woCRT); Assert.AreEqual (CapiXml832woCRT, rsa.ToXmlString (true), "Capi-Xml832-WithoutCRT"); rsa.FromXmlString (CapiXml896woCRT); Assert.AreEqual (CapiXml896woCRT, rsa.ToXmlString (true), "Capi-Xml896-WithoutCRT"); rsa.FromXmlString (CapiXml960woCRT); Assert.AreEqual (CapiXml960woCRT, rsa.ToXmlString (true), "Capi-Xml960-WithoutCRT"); rsa.FromXmlString (CapiXml1024woCRT); Assert.AreEqual (CapiXml1024woCRT, rsa.ToXmlString (true), "Capi-Xml1024-WithoutCRT"); rsa.FromXmlString (CapiXml1536woCRT); Assert.AreEqual (CapiXml1536woCRT, rsa.ToXmlString (true), "Capi-Xml1536-WithoutCRT"); rsa.FromXmlString (CapiXml2048woCRT); Assert.AreEqual (CapiXml2048woCRT, rsa.ToXmlString (true), "Capi-Xml2048-WithoutCRT"); } private void EncryptDecrypt (string msg, RSAManaged rsa) { RSAParameters param = rsa.ExportParameters (false); byte[] data = { 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 }; // we don't need the private key to encrypt RSAManaged pubkey = new RSAManaged (); pubkey.ImportParameters (param); byte[] enc = pubkey.EncryptValue (data); byte[] dec = rsa.DecryptValue (enc); // note: the decrypted value is now right padded with zeros Assert.IsTrue (BitConverter.ToString (dec).EndsWith (BitConverter.ToString (data)), msg); } // Validate that we can sign with every keypair and verify the signature // With Mono this means that we can use CAPI keypair to sign and verify. // For Windows this doesn't mean much. [Test] public void CapiEncryptDecrypt () { RSAManaged rsa = new RSAManaged (); rsa.FromXmlString (CapiXml384); EncryptDecrypt ("Capi-384", rsa); rsa.FromXmlString (CapiXml448); EncryptDecrypt ("Capi-448", rsa); rsa.FromXmlString (CapiXml512); EncryptDecrypt ("Capi-512", rsa); rsa.FromXmlString (CapiXml576); EncryptDecrypt ("Capi-576", rsa); rsa.FromXmlString (CapiXml640); EncryptDecrypt ("Capi-640", rsa); rsa.FromXmlString (CapiXml704); EncryptDecrypt ("Capi-704", rsa); rsa.FromXmlString (CapiXml768); EncryptDecrypt ("Capi-768", rsa); rsa.FromXmlString (CapiXml832); EncryptDecrypt ("Capi-832", rsa); rsa.FromXmlString (CapiXml896); EncryptDecrypt ("Capi-896", rsa); rsa.FromXmlString (CapiXml960); EncryptDecrypt ("Capi-960", rsa); rsa.FromXmlString (CapiXml1024); EncryptDecrypt ("Capi-1024", rsa); rsa.FromXmlString (CapiXml1536); EncryptDecrypt ("Capi-1536", rsa); rsa.FromXmlString (CapiXml2048); EncryptDecrypt ("Capi-2048", rsa); } [Test] public void CapiEncryptDecryptWithoutCRT () { RSAManaged rsa = new RSAManaged (); rsa.FromXmlString (CapiXml384woCRT); EncryptDecrypt ("Capi-384-WithoutCRT", rsa); rsa.FromXmlString (CapiXml448woCRT); EncryptDecrypt ("Capi-448-WithoutCRT", rsa); rsa.FromXmlString (CapiXml512woCRT); EncryptDecrypt ("Capi-512-WithoutCRT", rsa); rsa.FromXmlString (CapiXml576woCRT); EncryptDecrypt ("Capi-576-WithoutCRT", rsa); rsa.FromXmlString (CapiXml640woCRT); EncryptDecrypt ("Capi-640-WithoutCRT", rsa); rsa.FromXmlString (CapiXml704woCRT); EncryptDecrypt ("Capi-704-WithoutCRT", rsa); rsa.FromXmlString (CapiXml768woCRT); EncryptDecrypt ("Capi-768-WithoutCRT", rsa); rsa.FromXmlString (CapiXml832woCRT); EncryptDecrypt ("Capi-832-WithoutCRT", rsa); rsa.FromXmlString (CapiXml896woCRT); EncryptDecrypt ("Capi-896-WithoutCRT", rsa); rsa.FromXmlString (CapiXml960woCRT); EncryptDecrypt ("Capi-960-WithoutCRT", rsa); rsa.FromXmlString (CapiXml1024woCRT); EncryptDecrypt ("Capi-1024-WithoutCRT", rsa); rsa.FromXmlString (CapiXml1536woCRT); EncryptDecrypt ("Capi-1536-WithoutCRT", rsa); rsa.FromXmlString (CapiXml2048woCRT); EncryptDecrypt ("Capi-2048-WithoutCRT", rsa); } // all keypairs generated by Mono on Windows string MonoXml384 = "i9COhlY/aGJD+B0fjUtOR+bbDkKyrwDzXzvwbBE8TJmtFYNrjfLHOj/gjdKCEcqbEQ==

tJ2yzv36kToJOy2vURzL9X+W0YsKiHZr

xitaV4u8NRFVtIuFvYWArakoLHFeUiiRdN6CwiveXfhgU3fp6TDANXCs4fCOWEyfaOnGapVFhYGl2A2hKBmAW/AkU8OMSZ0BbU13UMhy7nsqfFtm7AhyjkJT4GCd/OPTGKxVYwApTqft4H2cJ/46/aE1tzjyWx5IzfYoG1Qmnzr+u1/rf+EGkyIzGWIEcyXR
"; string MonoXml448 = "rGhbXQawiO5muvnbq7FuVZc3QuFp2CZNqHekmRA/fdUzmUP6jFH7usaVh1kZ+Fk0em0fJzjOYgU=EQ==

rp5tO6WKHonnIRHxS8e566iNe20quz30u3R2Yw==

/MIc/2TV6WPi9ddM5NzLeaukuv7pmZf/VfFedw==j83DXkwXZHGRKksC8xzzdscLGlnm9I1gIedwjQ==hdAteCZTITThkTW/S/xruOJmROFOfn2lS53mtw==L0fk3nG45E5WbtKkFODlQjMQGIdSEwlsvt/TYA==ZWqQGJqF9jHiE6IIv1lP9hy3GEhcYQd4+a/KOvAKrWm95W6eF+aDWFgzao9lR1/BLP86HhcucSk=
"; string MonoXml512 = "jq1Bst+LWM5ScL29w+C/GVULDAebcT0Kl9ERGp/I2A2qJ4jHuzr7ltoQqtVGRquQwwDZQ/o1fH99bWraz5Fi7w==EQ==

1O1TVs0UsUSx7Vjg7H/n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40=dYOYJxCnJUZLastml8Fu9/HoW+DoX3OQ/I2b3aRBYByh7dpeRPaMdtycHgSNtMAocYDXMypl+f92vHFXENc4WFtEVAQSkxgD2IWTgQEj92kmaCA8Jrs8boH3eXfLb6ZlHf1fas5lIreq5Gzj/0IC0zDlYKBWOQf/3d+mxI9kbyw=f2W2y/lNTueIhwGv1uDu0NOjPU5GKWH/CwoinpvKBNqbdwwOKSd35X+QeiH46Dcv/CJPIRCLSlnr4BAMlABhSD+88tVFkqs+BIO4n1nBALWdGillQMCGAsCzkPAtHiJjtib39ilfgSfv6ensz6OiU6TEhKRlAFcpbkFTCQ8+axtxer2M3TiaAarE3njI65lgOwmu+djnqDyKWzfGcA37QafIQPOnWiMIgtBWfKetnKXtk1ReqdDw2IckUNBud4EeRStM7jy7MlVNc0TXiTDK7ow+Vd2EIPGpQXkav167V4F4Lc7VYrGDrFTV2fM66uBBcmgaH3gUOVGq0qUttAuZLQ==
"; // same keypairs but without CRT string MonoXml384woCRT = "i9COhlY/aGJD+B0fjUtOR+bbDkKyrwDzXzvwbBE8TJmtFYNrjfLHOj/gjdKCEcqbEQ==GKxVYwApTqft4H2cJ/46/aE1tzjyWx5IzfYoG1Qmnzr+u1/rf+EGkyIzGWIEcyXR"; string MonoXml448woCRT = "rGhbXQawiO5muvnbq7FuVZc3QuFp2CZNqHekmRA/fdUzmUP6jFH7usaVh1kZ+Fk0em0fJzjOYgU=EQ==ZWqQGJqF9jHiE6IIv1lP9hy3GEhcYQd4+a/KOvAKrWm95W6eF+aDWFgzao9lR1/BLP86HhcucSk="; string MonoXml512woCRT = "jq1Bst+LWM5ScL29w+C/GVULDAebcT0Kl9ERGp/I2A2qJ4jHuzr7ltoQqtVGRquQwwDZQ/o1fH99bWraz5Fi7w==EQ==bRsUH1+my3CZZUXNWY2/T5tizPbCKWrp+5/f5y7k4XK2d7xCN+qSZxn+nT0patdhewBMFOI9/xp5zD4U/seSIQ=="; string MonoXml576woCRT = "h18QgR8YiVXKVmcTRuPfHljm9Yz5vPt9UXg25GU2WztihEihEyZYMJaRzEb8/iS7eGg7jLXW8SrxhyLUnXfgWvtn/9uNGinjEQ==b3t3AOxujzeXknMA0Pfk69C+M6FGIyl2Qxe0vBcdtItCEpYpGKlxv+l1rPu1/VOy4F8Q3u+5dMuhc2OlLfX7F6WkL5+dN7pB"; string MonoXml640woCRT = "4YELOUiQPs7Nw6AM2m14LxuKDk1dXGYhvKczD6mB2//U4sitp+MFReJ0ot840hQNwwCssw8hyyniFqIvSjKJknv+HFL4Lc3AyCP3pL5iFf0=EQ==rHG9SewyEelwLC8Y40SnMxUPOB0LKIpWCLwX/OsI84dmj04qcVNAQxB0O5hmt5GXswJd1VPOdRmf/YrMiLZhIHFbLgdrQP+gyWGCSu3koz0="; string MonoXml704woCRT = "mUDm0P3S9oPB06NJT5oDFS5+Xy/ACBvGdkvNjCiZo9bOLvVpOsiih9ipWZw9zQInjfP0uhGqDBkl9jw61yEHIqed151b9hkO2cmfb2o3GvPkbXkoMcoxBQ==EQ==WiYta+CaNqfbbW8cELTywSpodDo0uXnACVnENFQeJCQA0FQfyDnJBJ2Qy0vuhbaAbz2qNXZcYp6QxbeBQQZGEB//nahkNns7KxKXDEFMMU1ghU9eoubr8Q=="; string MonoXml768woCRT = "pnVBGKuCV1sdnZP7yHMKlMnyc+4MZicSRDu6ESWPKUx/Ab2fbwwOoHDE5pSW/wCGziaEA2Agfwt6YKAr/JyPmcBcHichUjhzjDvExBrdd3jmQ1WjjNzV829+qSEq0kUlEQ==kt/uJNORH+b8A4KS3gsndDm3z7Ps0prx//h3ABIU6DRwEJhBYfuUb3KPnkbflbUqONprCS1FlC0mo+Hxald/r99a5PE3JWiVTN4GHuZ3zYEviEvRtNsOG7XYKydTUO3F"; string MonoXml832woCRT = "3dVclQYr1ks5x8VXLcO0H0BRNlmg/XT01IFso0aQY5AwU/kFbDUwTSrmSZCuRBk2blp14BYvpwpviuP9WkIcjhTSuPwPD1XWSl33WHSWEc6uYEHxjn0gieH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KSd35X+QeiH46Dcv/CJPIRCLSlnr4BAMlABhSD+88tVFkqs+BIO4n1nBALWdGillQMCGAsCzkPAtHiJjtib39ilfgSfv6ensz6OiU6TEhKRlAFcpbkFTCQ8+axtxer2M3TiaAarE3njI65lgOwmu+djnqDyKWzfGcA37QafIQPOnWiMIgtBWfKetnKXtk1ReqdDw2IckUNBud4EeRStM7jy7MlVNc0TXiTDK7ow+Vd2EIPGpQXkav167V4F4Lc7VYrGDrFTV2fM66uBBcmgaH3gUOVGq0qUttAuZLQ=="; // import/export XML keypairs // so we know that Windows (original MS Framework) can use keypairs generated by Mono [Test] public void MonoXmlImportExport () { RSAManaged rsa = new RSAManaged (); rsa.FromXmlString (MonoXml384); Assert.AreEqual (MonoXml384, rsa.ToXmlString (true), "Mono-Xml384"); rsa.FromXmlString (MonoXml448); Assert.AreEqual (MonoXml448, rsa.ToXmlString (true), "Mono-Xml448"); rsa.FromXmlString (MonoXml512); Assert.AreEqual (MonoXml512, rsa.ToXmlString (true), "Mono-Xml512"); rsa.FromXmlString (MonoXml576); Assert.AreEqual (MonoXml576, rsa.ToXmlString (true), "Mono-Xml576"); rsa.FromXmlString (MonoXml640); Assert.AreEqual (MonoXml640, rsa.ToXmlString (true), "Mono-Xml640"); rsa.FromXmlString (MonoXml704); Assert.AreEqual (MonoXml704, rsa.ToXmlString (true), "Mono-Xml704"); rsa.FromXmlString (MonoXml768); Assert.AreEqual (MonoXml768, rsa.ToXmlString (true), "Mono-Xml768"); rsa.FromXmlString (MonoXml832); Assert.AreEqual (MonoXml832, rsa.ToXmlString (true), "Mono-Xml832"); rsa.FromXmlString (MonoXml896); Assert.AreEqual (MonoXml896, rsa.ToXmlString (true), "Mono-Xml896"); rsa.FromXmlString (MonoXml960); Assert.AreEqual (MonoXml960, rsa.ToXmlString (true), "Mono-Xml960"); rsa.FromXmlString (MonoXml1024); Assert.AreEqual (MonoXml1024, rsa.ToXmlString (true), "Mono-Xml1024"); rsa.FromXmlString (MonoXml1536); Assert.AreEqual (MonoXml1536, rsa.ToXmlString (true), "Mono-Xml1536"); rsa.FromXmlString (MonoXml2048); Assert.AreEqual (MonoXml2048, rsa.ToXmlString (true), "Mono-Xml2048"); } [Test] public void MonoXmlImportExportWithoutCRT () { RSAManaged rsa = new RSAManaged (); rsa.FromXmlString (MonoXml384woCRT); Assert.AreEqual (MonoXml384woCRT, rsa.ToXmlString (true), "Mono-Xml384-WithoutCRT"); rsa.FromXmlString (MonoXml448woCRT); Assert.AreEqual (MonoXml448woCRT, rsa.ToXmlString (true), "Mono-Xml448-WithoutCRT"); rsa.FromXmlString (MonoXml512woCRT); Assert.AreEqual (MonoXml512woCRT, rsa.ToXmlString (true), "Mono-Xml512-WithoutCRT"); rsa.FromXmlString (MonoXml576woCRT); Assert.AreEqual (MonoXml576woCRT, rsa.ToXmlString (true), "Mono-Xml576-WithoutCRT"); rsa.FromXmlString (MonoXml640woCRT); Assert.AreEqual (MonoXml640woCRT, rsa.ToXmlString (true), "Mono-Xml640-WithoutCRT"); rsa.FromXmlString (MonoXml704woCRT); Assert.AreEqual (MonoXml704woCRT, rsa.ToXmlString (true), "Mono-Xml704-WithoutCRT"); rsa.FromXmlString (MonoXml768woCRT); Assert.AreEqual (MonoXml768woCRT, rsa.ToXmlString (true), "Mono-Xml768-WithoutCRT"); rsa.FromXmlString (MonoXml832woCRT); Assert.AreEqual (MonoXml832woCRT, rsa.ToXmlString (true), "Mono-Xml832-WithoutCRT"); rsa.FromXmlString (MonoXml896woCRT); Assert.AreEqual (MonoXml896woCRT, rsa.ToXmlString (true), "Mono-Xml896-WithoutCRT"); rsa.FromXmlString (MonoXml960woCRT); Assert.AreEqual (MonoXml960woCRT, rsa.ToXmlString (true), "Mono-Xml960-WithoutCRT"); rsa.FromXmlString (MonoXml1024woCRT); Assert.AreEqual (MonoXml1024woCRT, rsa.ToXmlString (true), "Mono-Xml1024-WithoutCRT"); rsa.FromXmlString (MonoXml1536woCRT); Assert.AreEqual (MonoXml1536woCRT, rsa.ToXmlString (true), "Mono-Xml1536-WithoutCRT"); rsa.FromXmlString (MonoXml2048woCRT); Assert.AreEqual (MonoXml2048woCRT, rsa.ToXmlString (true), "Mono-Xml2048-WithoutCRT"); } [Test] public void MonoEncryptDecrypt () { RSAManaged rsa = new RSAManaged (); rsa.FromXmlString (MonoXml384); EncryptDecrypt ("Mono-384", rsa); rsa.FromXmlString (MonoXml448); EncryptDecrypt ("Mono-448", rsa); rsa.FromXmlString (MonoXml512); EncryptDecrypt ("Mono-512", rsa); rsa.FromXmlString (MonoXml576); EncryptDecrypt ("Mono-576", rsa); rsa.FromXmlString (MonoXml640); EncryptDecrypt ("Mono-640", rsa); rsa.FromXmlString (MonoXml704); EncryptDecrypt ("Mono-704", rsa); rsa.FromXmlString (MonoXml768); EncryptDecrypt ("Mono-768", rsa); rsa.FromXmlString (MonoXml832); EncryptDecrypt ("Mono-832", rsa); rsa.FromXmlString (MonoXml896); EncryptDecrypt ("Mono-896", rsa); rsa.FromXmlString (MonoXml960); EncryptDecrypt ("Mono-960", rsa); rsa.FromXmlString (MonoXml1024); EncryptDecrypt ("Mono-1024", rsa); rsa.FromXmlString (MonoXml1536); EncryptDecrypt ("Mono-1536", rsa); rsa.FromXmlString (MonoXml2048); EncryptDecrypt ("Mono-2048", rsa); } [Test] public void MonoEncryptDecryptWithoutCRT () { RSAManaged rsa = new RSAManaged (); rsa.FromXmlString (MonoXml384woCRT); EncryptDecrypt ("Mono-384-WithoutCRT", rsa); rsa.FromXmlString (MonoXml448woCRT); EncryptDecrypt ("Mono-448-WithoutCRT", rsa); rsa.FromXmlString (MonoXml512woCRT); EncryptDecrypt ("Mono-512-WithoutCRT", rsa); rsa.FromXmlString (MonoXml576woCRT); EncryptDecrypt ("Mono-576-WithoutCRT", rsa); rsa.FromXmlString (MonoXml640woCRT); EncryptDecrypt ("Mono-640-WithoutCRT", rsa); rsa.FromXmlString (MonoXml704woCRT); EncryptDecrypt ("Mono-704-WithoutCRT", rsa); rsa.FromXmlString (MonoXml768woCRT); EncryptDecrypt ("Mono-768-WithoutCRT", rsa); rsa.FromXmlString (MonoXml832woCRT); EncryptDecrypt ("Mono-832-WithoutCRT", rsa); rsa.FromXmlString (MonoXml896woCRT); EncryptDecrypt ("Mono-896-WithoutCRT", rsa); rsa.FromXmlString (MonoXml960woCRT); EncryptDecrypt ("Mono-960-WithoutCRT", rsa); rsa.FromXmlString (MonoXml1024woCRT); EncryptDecrypt ("Mono-1024-WithoutCRT", rsa); rsa.FromXmlString (MonoXml1536woCRT); EncryptDecrypt ("Mono-1536-WithoutCRT", rsa); rsa.FromXmlString (MonoXml2048woCRT); EncryptDecrypt ("Mono-2048-WithoutCRT", rsa); } [Test] [ExpectedException (typeof (CryptographicException))] public void Bug79269 () { RSAManaged rsa = new RSAManaged (); rsa.FromXmlString ("iSObDmmhDgrl4NiLaviFcpv4NdysBWJcqiVz3AQbPdajtXaQQ8VJdfRkixah132yKOFGCWZhHS3EuPMh8dcNwGwta2nh+m2IV6ktzI4+mZ7CSNAsmlDY0JI+H8At1vKvNArlC5jkVGuliYroJeSU/NLPLNYgspi7TtXGy9Rfug8=EQ=="); Assert.IsTrue (rsa.PublicOnly, "PublicOnly"); string b64 = @"YgyAhscnTTIcDeLJTZcOYYyHVxNhV6d03jeZYjq0sPMEsfCCbE/NcFyYHD9BTuiduqPplCLbGpfZIZYJ6vAP9m5z4Q9eEw79kmEFCsm8wSKEo/gKiptVpwQ78VOPrWd/wEkTTeeg2nVim3JIsTKGFlV7rKxIWQhGN9aAqgP8nZI="; byte [] bytes = Convert.FromBase64String (b64); rsa.DecryptValue (bytes); } } }