EncryptedXml DecryptDocument method throws “Bad Data” exception

后端 未结 2 1229
心在旅途
心在旅途 2021-01-03 01:29

I wrote a code block for Encrypt/Decrypt Streams. The code is working in my local machine. But when I publish my code on web The Decryption functions throws \"Bad Data\" ex

2条回答
  •  有刺的猬
    2021-01-03 02:05

    Do not reinvent cryptography protocols. You will get it wrong. Case in point, mishandling the RSA key stored in the CSPs and expect them to magically appear on any machine.

    To encrypt data in transfer, use SSL/TLS. .Net offers it out-of-the-box with SslStream. For WCF see How to: Configure an IIS-hosted WCF service with SSL.

提交回复
热议问题