未验证 提交 1b441334 编写于 作者: A Andrew Au 提交者: GitHub

Avoid infinite recursion in RSAEncryptionPadding equality check

......@@ -100,7 +100,7 @@ public override bool Equals(object obj)
public bool Equals(RSAEncryptionPadding other)
{
return other != null
return !object.ReferenceEquals(other, null)
&& _mode == other._mode
&& _oaepHashAlgorithm == other._oaepHashAlgorithm;
}
......
......@@ -192,6 +192,12 @@ public void VerifyDataStream_UsesHashDataAndVerifyHash()
Assert.True(rsa.VerifyData(new MemoryStream(new byte[] { 42 }), new byte[1] { 24 }, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1));
}
[Fact]
public void RSAEncryptionPadding_Equals()
{
Assert.Equal(RSAEncryptionPadding.Pkcs1, RSAEncryptionPadding.Pkcs1);
}
private sealed class EmptyRSA : RSA
{
public override RSAParameters ExportParameters(bool includePrivateParameters) => throw new NotImplementedException();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册