1

We are using Spring Boot for web development and PostgreSQL as Back-end

We have user_table where we store user mobile number in encrypted format and for encryption and decryption values, AES algorithm is used in business logic layer.

We are displaying User list at front side and provided "Search Filter" text-box element so User can search any values contains in User name or other values like City, State etc in user_table rows.

Please note that we are using pagination at server side.

But we can not search by mobile number in Database as it is stored in encrypted format.If we use client side pagination then it can search within list but it is not possible to change pagination from server side to client side.

Please guide me that how can I search users by mobile number in DB with encrypted value.

1

2 Answers 2

0

That's impossible with database means: If the value is encrypted in the database, the database doesn't know the clear text value. That is good for security, but the database cannot use an index for that value.

The exception may be search for equality: You could encrypt the value you are looking for and use a btree or hash index to search for all values in the database whose encrypted form is exactly that value.

Sign up to request clarification or add additional context in comments.

Comments

0

If your encryption method uses a salt or a random iteration count, then you can't do this in the database (just 'AES' doesn't tell us that). If it does not, then the same value encrypted with the same key should give the same answer each time. Then you should be able to encrypt the query term on the client and send that to the database to search for equality.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.