Given key K
, salt Salt
which is 32 randomly generated bytes is used to derive keys EKey
and AKey
using HKDF-SHA256
.
A Ciphertext
is produced using AES-256-CBC
with key EKey
and a random 16-byte iv Iv
.
An Hmac
is produced using HMAC-256
with key AKey
.
This is encoded as the following.
Salt
. Iv
. Ciphertext
. Hmac
My question is, can I RSA encrypt key K
and append it to the encoded string such that it remains secure?
Edit 1
I'm not entirely sure how to respond to Rory's comment, so I'll give my best shot.
By secure, I mean being able to transport this payload over the wire without having a third-party (without the corresponding private RSA key) able to decrypt or mutate the payload.
This approach may also be used for data at rest.