public void CanCreateVerifyableSignature() { var payload = new byte[] { 1, 2, 3 }; var key = RSA.Create(); var signature = new RsaSignature(payload, key); Assert.True(signature.Verify(payload, key.ExportRSAPublicKey())); }
public void CannotVerifySignatureWithWrongKey() { var payload = new byte[] { 1, 2, 3 }; var key = RSA.Create(); var otherKey = RSA.Create(); var signature = new RsaSignature(payload, key); Assert.False(signature.Verify(payload, otherKey.ExportRSAPublicKey())); }
public void CannotVerifySignatureWithWrongPayload() { var payload1 = new byte[] { 1, 2, 3 }; var payload2 = new byte[] { 2, 3, 4 }; var key = RSA.Create(); var signature = new RsaSignature(payload1, key); Assert.False(signature.Verify(payload2, key.ExportRSAPublicKey())); }