Unwrapping a key using a certificate
I have to write java code that would wrap a key, using a certificate, and reversely unwrap that key afterwards.
I'm half way there, since wrapping seems to work all right, but when it comes to unwrapping, I'm getting a "data hash wrong" error.
And this happens in both cases, ie no matter if I'm using the certificate or its public key.
I've been googling around for the pas 2 days, but could not find any relevant example to help me out :(
Thank you in advance for any hint you could give :)
PFA source code I'm using.