skip to Main Content

This is just a clarification question.

So if we implement encryption at rest in mongoDB, will it affect querying in any anyway?

I’m asking this because I’m currently encrypting the fields on the client side manually, and I need to sort over the encrypted fields, but the sorting is happening on the encrypted text and not on the plain text. I read rather ambiguously that by using mongodb encryption at rest, we can sort on the plain text, while still having the fields encrypted in the mongoDB.

Is this a solution?

Is there any documentation while specifies this?

2

Answers


  1. You’re asking two questions here I think,

    1. If you choose a deterministic encryption, you will be able to query for fields based on exact values – if you encrypt an entire object, exact means the entire object – not a subfield of it.
    2. Regardless of which encryption scheme you use, you will not be able to meaningfully sort

    Encryption algorithms that are order preserving are quite hard to design to still be effectively encrypted.

    Login or Signup to reply.
  2. Encryption at Rest is server-side encryption where the data is unencrypted in the server’s memory, and is encrypted before being written to disk.

    Field Level Encryption encrypts the data on the client side before sending the server, so the server never has access to the plain text value.

    Using encryption at rest all users that can authenticate and are authorized can read the data. Field level encryption adds the additional requirement that the user have access to the decryption key for that field.

    Both FLE and EAR can be used simultaneously.

    Encryption at rest allows the server to see the plaintext values, so it can query and sort normally on those values.

    For extremely sensitive fields this is a security tradeoff, if you encrypt on the server side you can query and sort normally, but the data is plaintext in the server memory and accessible to anyone with the correct username and password.

    Using FLE with queryable encryption allows sorting and ranged queries on the data while keeping it encrypted, the tradeoff here being that the encryption algorithm is not as strong. The simple fact that the ciphertext sorts in the same order as the plaintext can leak information about the data. Refer to Searching and sorting encrypted data for discussion

    Using FLE with deterministic encryption provides the stronger encryption for the field, but sort on the server side becomes impossible, and the only meaningful query that can be performed is equality.

    Using FLE with randomized encryption the same plaintext data will result in the same ciphertext every time. This is the strongest level of encryption, but does not support any meaningful querying.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search