title: The data to be decrypted exceeds the maximum for this modulus of 36 bytes
body: <p>I'm trying to make a password safe, but theres something wrong with how I use RSA.
  Heres my codes:</p>
  
  <pre><code>    private void testencodedecode()
      {
          string mehdi = "mehdi";
          var enc = encodePass(mehdi);
          var dec = decodePass(enc);
      }
      private RSAParameters rsaKey()
      {
          var setting = context.Settings.First(s =&gt; s.ID == 1);
  
          byte[] pwd = Encoding.ASCII.GetBytes(setting.PWDKEY);
  
          byte[] expo = {1,0,1};
  
          var key = new System.Security.Cryptography.RSAParameters();
          key.Exponent = expo;
          key.Modulus = pwd;
  
          return key;
      }
  
      private string encodePass(string pass)
      {
          var provider = new RSACryptoServiceProvider();
          provider.ImportParameters(rsaKey());
  
          var encryptedBytes = provider.Encrypt(Encoding.UTF8.GetBytes(pass), false);
  
          return Encoding.UTF8.GetString(encryptedBytes);
      }
  
      private string decodePass(string pass)
      {
         var provider = new RSACryptoServiceProvider();
         provider.ImportParameters(rsaKey());
         string decrypted = Encoding.UTF8.GetString(provider.Decrypt(Encoding.UTF8.GetBytes(pass), true));
         return decrypted;
      }
  </code></pre>
  
  <p>It seems to encrypt fine, but on decryption has the following error:  </p>
  
  <blockquote>
    <p>The data to be decrypted exceeds the maximum for this modulus of 36 bytes.</p>
  </blockquote>