Fix #87: security helper converted into component and improved

Fix #87: security helper improvement

Migrated from #4052
could add another note:
> You may configure two components `'legacySecurity'` and `'security'` with different configurations to use the legacy component to deal with values encrypted with the old class.