0

I have domain with 3 field cardNo, cardName and account

class card {
    String cardNo
    String cardName
    Account account

static constraints = {
    cardNo(blank:false, unique:true)
    cardName(blank:false)
    account(blank:false)
}

The cardNo must be encrypted when saved, I used encryptionUtil Java to encrypt it. On my list screen, I want to make search fiture, which can be search by cardNo and cardName. Is it possibe if I search data encrypted with create cretiria in grails?? If can't use create criteria, what is the best way to search encrypted data?? Need your help. thanks before :)

dope
  • 21
  • 1
  • 5
  • Unless you're going to reproduce the exact same encrypted value as a search parameter, you cannot search into encrypted data. That's one of the points of the encryption. – codelark Aug 28 '13 at 15:19

1 Answers1

3

I can give you an advice: avoid store card numbers in your database. Use payment services for it.

Mr. Cat
  • 3,522
  • 2
  • 17
  • 26
  • Hmm I store the cardNo in database by encrypted it, then in my list I want to search by cardNo for exampe the cardNo is 112211, then in the search textfield I input "1" then klik the search button, and then on the list table the cardName and account with that cardNo 112211 will be appeared. – dope Aug 28 '13 at 10:04