I am trying to write a software that will inject keys generated inside an HSM into a POS device, in the same way as described here
I'm using the Safenet emulator(software-mode) + the wrap/unwrap functionality to achieve this but I've not been able to decrypt/unwrap the data I'm getting out of the HSM through the Key Management Utility.
It seems I'm just getting garbage trying to decrypt the file which supposedly is the private key encrypted with a mock AES key that would be all zeroes for this test, and the same happens when trying to get an AES key wrapped with another AES key(even when both are all zeroes!) (for the RSA one, I've tried looking at the hex to see if it's a DER format, and I've also tried using openssl commands with it hoping there would be a key there but I think not...)
Could anyone advise me on what could be going wrong here? Is there more to the wrap/unwrap algorithm than a simple encryption/decription procedure? Is there a default Block and Padding mode being used that I'm not aware of? Any help is appreciated