So I'm messing around in the BouncyCastle library with the RFC 3394 AES Key Wrap engine and I'm trying to understand the benefit of it.
The problem I'm running into is how to store keys securely on a device like a phone or even a laptop or desktop. I need to wrap the keys so that anyone snooping around in memory can't just get those keys. RFC 3394 looks as though it's designed to help with that issue.
I can just do
$$ \bar k = \operatorname{wrap}_{k^*, IV}(k) $$
and store $\bar k$ instead of $k$, and use
$$ k = \operatorname{unwrap}_{k^*, IV}(\bar k)$$
to retrieve $k$ again when I need it.
I've written this code in C# to test it out. This seems to work okay, except for the fact that I'm trying to understand how this is more secure. At some point I have to store the key encryption key $k^*$ in memory, and it seems to me that any hacker who could get their hands on $k^*$ now has their hands on the encryption keys.
So how does this secure the encryption keys in memory?