Re: [RavenDB] RavenDB 2.0 Error Padding is invalid and cannot be removed.

83 views
Skip to first unread message

Oren Eini (Ayende Rahien)

unread,
Jan 17, 2013, 10:17:12 PM1/17/13
to ravendb
Thanks, we will check that and see what is going on.
It'll probably take a day or two, mind.


On Thu, Jan 17, 2013 at 11:13 PM, Jason Rowe <jason...@gmail.com> wrote:
Has anyone ran into the following error when using encryption in RavenDB 2.0?

"System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed."

Here is how to recreate the issue:


  1. Create new Database
  2. Add Encryption Bundle
  3. Choose Encryption Algorithm - Rijndael
  4. Check Encrypt Indexes
  5. Add the following document via admin site

{
  "OrgId": "1",
  "Aliases": {
    "TestValue": {
      "Key": "TestValue",
      "Value": "TestValue",
      "StylesheetId": null
    },
    "TestValue2": {
      "Key": "TestValue2",
      "Value": "TestValue2",
      "StylesheetId": null
    }
  }
}

  1. Save document.
  2. Edit document to the following by removing one value:
{
  "OrgId": "1",
  "Aliases": {
    "TestValue": {
      "Key": "TestValue",
      "Value": "TestValue",
      "StylesheetId": null
    }
  }
}

Save the document again and you should see the error.

Doing a little debugging I see the error is thrown when the HttpListenerContextAdapter does FinalizeResponse(). I believe this is causing an underlying crypto stream to get closed at the wrong time. I haven't been able to find out which stream is causing the problem yet or if this is even the real issue. Any help would be appreciated.


Oren Eini (Ayende Rahien)

unread,
Jan 25, 2013, 6:05:19 AM1/25/13
to ravendb
Thanks, reproduce and checking this now.

Oren Eini (Ayende Rahien)

unread,
Jan 26, 2013, 2:02:01 PM1/26/13
to ravendb
Thanks, found the problem, it was a problem in the studio not writing the proper encryption type to the db settings.

Oren Eini (Ayende Rahien)

unread,
Jan 26, 2013, 2:02:11 PM1/26/13
to ravendb
Fixed and will be in the next build.

Oren Eini (Ayende Rahien)

unread,
Jan 26, 2013, 2:12:58 PM1/26/13
to ravendb
Correction, this is an issue with a document become smaller, which result in... interesting things happening.
Thanks for finding out about this, will be there in the next build.

Jason Rowe

unread,
Jan 28, 2013, 2:44:40 PM1/28/13
to rav...@googlegroups.com
Thanks, sounds like a tricky one. I'll keep my eye out for the fix and give it some testing.
Reply all
Reply to author
Forward
0 new messages