[dnssec] KASP dir, generalize entity encoding
[dnssec] keymgr, possible invalid memory access

Unlikely, but asprintf output string value is undefined on failure.
[dnssec] KASP dir, tests for entity and file name conversions