Using RSA encryption, I pass the encrypted data from the client to the server decrypt. When trying to decrypt, it gives me an exception CryptographicException
with the message:
Invalid flags specified.
I have no idea Flag may be missing.
My code looks like this:
byte[] decryptedMessage;
RSACryptoServiceProvider asr = new RSACryptoServiceProvider(128);
decryptedMessage = asr.Decrypt(buffer, false);
at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException (Int32 hr) in System.Security.Cryptography.Utils._GenerateKey (SafeProvHandle hProv, Int32 algid, CspProviderFlags flags, Int32 keySize, SafeKeyHandle & hKey) in System.Security.Cryptography.Utils.GetKeyPairHelper (CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle & safeProvHandle, SafeKeyHandle & safeKeyHandle) in System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair () in System.Security.Cryptography.RSACryptoServiceProvider.Decrypt (Byte [rgb, Boolean fOAEP]