title: How to add seek and position capabilities to CryptoStream
body: <p>I was trying to use CryptoStream with AWS .NET SDk it failed as seek is not supported on CryptoStream. I read somewhere with content length known we should be able to add these capabilities to CryptoStream. I would like to know how to do this; any sample code will be useful too.</p>
  
  <p>I have a method like this which is passed with a FieStream and returns a cryptoStream. I assign the returned Stream object to InputStream of AWS SDk PutObjectRequest object.</p>
  
  <pre><code>public static Stream GetEncryptStream(Stream existingStream,
      SymmetricAlgorithm cryptoServiceProvider,
      string encryptionKey, string encryptionIV)
  {
      Stream existingStream = this.dataStream;
  
      cryptoServiceProvider.Key = ASCIIEncoding.ASCII.GetBytes(encryptionKey);
      cryptoServiceProvider.IV = ASCIIEncoding.ASCII.GetBytes(encryptionIV);
      CryptoStream cryptoStream = new CryptoStream(existingStream,
          cryptoServiceProvider.CreateEncryptor(), CryptoStreamMode.Read);
  
      return cryptoStream ;
  }
  </code></pre>