-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
AsymmetricSignatureFormatterTests.cs
28 lines (25 loc) · 1.34 KB
/
AsymmetricSignatureFormatterTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.Security.Cryptography.Tests
{
/// <summary>
/// Helper methods for DSASignatureFormatterTests and RSASignatureFormatterTests
/// </summary>
[SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")]
public partial class AsymmetricSignatureFormatterTests
{
protected static void InvalidFormatterArguments(AsymmetricSignatureFormatter formatter)
{
Assert.Throws<ArgumentNullException>(() => formatter.SetKey(null));
Assert.Throws<ArgumentNullException>(() => formatter.CreateSignature((byte[])null));
Assert.Throws<CryptographicUnexpectedOperationException>(() => formatter.CreateSignature(new byte[] { 0, 1, 2, 3 }));
}
protected static void InvalidDeformatterArguments(AsymmetricSignatureDeformatter deformatter)
{
Assert.Throws<ArgumentNullException>(() => deformatter.SetKey(null));
Assert.Throws<ArgumentNullException>(() => deformatter.VerifySignature((byte[])null, new byte[] { 0, 1, 2 }));
Assert.Throws<CryptographicUnexpectedOperationException>(() => deformatter.VerifySignature(new byte[] { 0, 1, 2 }, new byte[] { 0, 1, 2 }));
}
}
}