You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
@@ -43,11 +43,12 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Exception is thrown: CryptographicException : Bad PKCS7 padding. Invalid length 236.
|
||||
public void Roundtrip ()
|
||||
{
|
||||
// that will return a AesCryptoServiceProvider
|
||||
var aes = GetInstance ();
|
||||
#if MOBILE
|
||||
#if MONOTOUCH
|
||||
Assert.AreEqual ("System.Security.Cryptography.AesManaged", aes.ToString (), "Default");
|
||||
Assert.AreEqual (128, aes.FeedbackSize, "FeedbackSize");
|
||||
#else
|
||||
|
@@ -316,15 +316,17 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
byte[] buffer = new byte [8];
|
||||
cs = new CryptoStream (s, encryptor, CryptoStreamMode.Read);
|
||||
cs.Clear ();
|
||||
Assert.AreEqual (0, cs.Read (buffer, 0, 8), "Read from disposed");
|
||||
try {
|
||||
cs.Read (buffer, 0, 8);
|
||||
Assert.Fail ();
|
||||
} catch (NotSupportedException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
[Test]
|
||||
// MS BUG [ExpectedException (typeof (ObjectDisposedException))]
|
||||
[Category ("NotWorking")]
|
||||
[ExpectedException (typeof (IndexOutOfRangeException))]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void Read_Disposed_Break ()
|
||||
{
|
||||
// do no corrupt readStream in further tests
|
||||
@@ -419,11 +421,8 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
cs.Read (buffer, Int32.MaxValue, 4);
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
[Test]
|
||||
// MS BUG [ExpectedException (typeof (ObjectDisposedException))]
|
||||
[Category ("NotWorking")]
|
||||
[ExpectedException (typeof (IndexOutOfRangeException))]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void Write_Disposed ()
|
||||
{
|
||||
// do no corrupt writeStream in further tests
|
||||
@@ -434,7 +433,6 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
cs.Write (buffer, 0, 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
@@ -819,7 +817,6 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
Assert.AreEqual ("ximian", Encoding.Unicode.GetString (data, 0, len), "Unicode DES Roundtrip");
|
||||
}
|
||||
|
||||
[Category ("NotWorking")]
|
||||
[Test]
|
||||
public void DecryptPartial_TransformFinalBlock_2Pass ()
|
||||
{
|
||||
@@ -846,7 +843,6 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
}
|
||||
|
||||
// based on http://www.c-sharpcorner.com/Code/2002/May/FileEncryption.asp
|
||||
[Category ("NotWorking")]
|
||||
[Test]
|
||||
public void WriteByteReadByte ()
|
||||
{
|
||||
@@ -1238,7 +1234,6 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
byte[] digest = hash.Hash;
|
||||
Assert.AreEqual ("71-04-12-D1-95-01-CF-F9-8D-8F-F8-0D-F9-AA-11-7D", BitConverter.ToString (digest), "Hash");
|
||||
}
|
||||
[Category ("NotWorking")]
|
||||
[Test]
|
||||
public void CascadedCryptoStream_Read ()
|
||||
{
|
||||
|
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// CspParametersTest.cs - NUnit Test Cases for CspParameters
|
||||
//
|
||||
// Author:
|
||||
// Marek Safar <marek.safar@gmail.com>
|
||||
//
|
||||
// Copyright (C) 2015 Xamarin Inc (http://www.xamarin.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.Security.Cryptography;
|
||||
|
||||
namespace MonoTests.System.Security.Cryptography {
|
||||
|
||||
[TestFixture]
|
||||
public class CspParametersTest {
|
||||
|
||||
[Test]
|
||||
public void Ctor ()
|
||||
{
|
||||
var cp = new CspParameters ();
|
||||
Assert.AreEqual (1, cp.ProviderType);
|
||||
}
|
||||
}
|
||||
}
|
@@ -326,17 +326,14 @@ public class DSACryptoServiceProviderTest {
|
||||
Assert.IsFalse (emptyDSA.VerifySignature (hash, sign));
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
[ExpectedException (typeof (ObjectDisposedException))]
|
||||
public void ImportDisposed ()
|
||||
{
|
||||
DSACryptoServiceProvider import = new DSACryptoServiceProvider (minKeySize);
|
||||
import.Clear ();
|
||||
import.ImportParameters (AllTests.GetKey (false));
|
||||
// no exception from Fx 2.0 +
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ObjectDisposedException))]
|
||||
|
@@ -229,7 +229,7 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (OverflowException))]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TransformBlock_InputCount_Negative ()
|
||||
{
|
||||
byte[] input = new byte [16];
|
||||
@@ -240,7 +240,7 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (OutOfMemoryException))]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TransformBlock_InputCount_Overflow ()
|
||||
{
|
||||
byte[] input = new byte [16];
|
||||
@@ -312,7 +312,7 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (OverflowException))]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TransformFinalBlock_InputCount_Negative ()
|
||||
{
|
||||
byte[] input = new byte [16];
|
||||
@@ -322,7 +322,7 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (OutOfMemoryException))]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TransformFinalBlock_InputCount_Overflow ()
|
||||
{
|
||||
byte[] input = new byte [16];
|
||||
|
@@ -209,7 +209,13 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
byte[] digest = { 0x6f, 0x63, 0x0f, 0xad, 0x67, 0xcd, 0xa0, 0xee, 0x1f, 0xb1, 0xf5, 0x62, 0xdb, 0x3a, 0xa5, 0x3e };
|
||||
Check ("RFC2202-TC7", key, data, digest);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Create_Incorrect ()
|
||||
{
|
||||
var x = HMACMD5.Create ();
|
||||
Assert.AreEqual ("SHA1", x.HashName, "https://connect.microsoft.com/VisualStudio/feedback/details/838731/all-hmac-create-methods-return-an-instance-of-hmacmd5");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -666,7 +666,7 @@ public class PasswordDeriveBytesTest {
|
||||
public void CryptDeriveKey_TooLongKey ()
|
||||
{
|
||||
PasswordDeriveBytes pd = new PasswordDeriveBytes ("password", null, "MD5", 1000);
|
||||
pd.CryptDeriveKey ("AlgName", "MD5", 256, new byte [8]);
|
||||
pd.CryptDeriveKey ("AlgName", "MD5", -256, new byte [8]);
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
|
@@ -1 +1 @@
|
||||
56f9a9be336792de7e413077cd16fe66c94338ef
|
||||
8a20b9add458b2d2ed9ff7c097f7a140479c7215
|
@@ -197,7 +197,7 @@ public class RSAPKCS1KeyExchangeDeformatterTest {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (CryptographicException))]
|
||||
[ExpectedException (typeof (CryptographicUnexpectedOperationException))]
|
||||
public void Bug79320 ()
|
||||
{
|
||||
string s = "hdphq/mn8goBi43YGPkmOfPj5vXjHrKPJkT4mLT3l+XzLttHMLC4/yBYkuzlXtbrl2jtAJRb6oA8UcQFalUMnCa09LDZrgNU2yySn7YbiG8raSq7u2nfDCbPu+c8T9fyHxrCHrX0zeqqImX33csIn6rIrQZ8HKcMsoQso4qtS2A=";
|
||||
|
@@ -322,5 +322,15 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
rsa.FromXmlString (xml);
|
||||
Assert.AreEqual (xmlPublic, rsa.ToXmlString (false), "Embedded");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FromXmlString_Namespaced ()
|
||||
{
|
||||
string rsakey = "<RSAKeyValue><Modulus>sjanng8QA1Puw5S563eglnZgwlQOMcLgAZWHVmWVzAfUotsKc+9HhLpobPdjPsjdJE64Jbx/1oQdjMtx5z9ty+5dlW5fausb4UbFfLSH38Nci/k/qasHCphiuJMtqCYNBYvisf/2rUsj0d5nSxvNNtp37SRbIZ7bDFpmp53kAJU=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
|
||||
string dsrsakey = "<ds:RSAKeyValue><ds:Modulus>sjanng8QA1Puw5S563eglnZgwlQOMcLgAZWHVmWVzAfUotsKc+9HhLpobPdjPsjdJE64Jbx/1oQdjMtx5z9ty+5dlW5fausb4UbFfLSH38Nci/k/qasHCphiuJMtqCYNBYvisf/2rUsj0d5nSxvNNtp37SRbIZ7bDFpmp53kAJU=</ds:Modulus><ds:Exponent>AQAB</ds:Exponent></ds:RSAKeyValue>";
|
||||
RSA rsa = RSA.Create();
|
||||
rsa.FromXmlString (rsakey);
|
||||
rsa.FromXmlString (dsrsakey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -75,7 +75,6 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ObjectDisposedException))]
|
||||
public void TransformBlock_Dispose ()
|
||||
{
|
||||
byte[] input = new byte [3];
|
||||
@@ -112,7 +111,6 @@ namespace MonoTests.System.Security.Cryptography {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ObjectDisposedException))]
|
||||
public void TransformFinalBlock_Dispose ()
|
||||
{
|
||||
byte[] input = new byte [3];
|
||||
|
Reference in New Issue
Block a user