Refactor and added unit test.

Need to verify tests.
remove debug croak
Now also works as object.
Merge branch 'master' into develop

Conflicts:
	lib/JSON/WebEncryption.pm