Merge pull request #1157 from Ryan-Everett-arm/key-management-buffer-protection-backport

[Backport] Key management buffer protection