Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1937

C# Driver 2.X does not allow upload to GridFS when FIPS is enabled

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.3, 2.4.2
    • Component/s: GridFS
    • Labels:
    • Environment:
      Windows 10 x64

      Hi
      If I enable FIPS then I can no longer upload streams to GridFS using the new driver (this worked on the old driver). This simple code shows the issue :

            var client = new MongoClient("mongodb://localhost:27017");
            var db = client.GetDatabase("Test");
            var gridfs = new GridFSBucket(db);
            const string filename = @"C:\temp\test.txt";
            System.IO.File.WriteAllText(filename, "THIS IS A TEST");
            try
            {
                var file = System.IO.File.Open(filename, FileMode.Open, FileAccess.Read);
                var id = gridfs.UploadFromStream(filename, file, null);
                file.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.InnerException.Message);
            }
      

      This yields the following error :

      {{ This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.}}

      I expect this is due to GridFSForwardOnlyUploadStream.cs using IncrementalMD5.

      We used to be able to upload with the old driver as we could specify disabling the MD5 check when connecting to GridFS :

          var settings = new MongoGridFSSettings { UpdateMD5 = false, VerifyMD5 = false };
      

      Thanks,
      Steve H

            Assignee:
            Unassigned Unassigned
            Reporter:
            hallio Steve Hall
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: