grails - Foreign Key Encryption W/ Jasypt and GORM ORM -


i work on project deals sensible data on database, need encrypt them.

my technical environment :

  • web framework : grails (v2.4.4)
  • orm : gorm (based on hibernate 4)
  • encryption library : jasypt (v1.3.1)

in data have encrypt, can figure out 2 cases :

  1. simple attribute (eg. forename, lastname, etc.). know how deal ( hibernate type transformation : http://www.jasypt.org/hibernate.html ). no problem one.

  2. link between 2 objects (eg. person object , job object). want break link between these 2 tables on database, therefore impossible find link between person , job "where" request on db. actual problem.

here sample example of code enlight case #2 :

parentclass.groovy :

class parentclass extends …  implements ...{      string id      static mapping = {         id generator: 'my.package.customgeneratorutils'      }    } 

childclass.groovy :

class childclass extends ... implements ...{      static belongsto = [parentclass : parentclass]      ...         static mapping = {          parentclass column: 'parentclass_id', insertable: false, updateable: false          parentclass type: gormencryptedstringtype      }      ...  } 

here list of elements regarding issue :

  • gorm automatically creates tables on db corresponding business objects
  • gorm automatically creates parentclass_id column childclass table in order make link
  • i have parentclass technical primary key, 0..n relation childclass
  • i need go through string typed id because encrypted value alphanumeric value. that's why use custom id generator allow me build string typed id classic sequence in db.
  • i'd keep parentclass id in clear, encrypt foreign key of childclass referencing parentclass table.

thank's !


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -