Encryption Web Api Rebex.Legacy.Cryptography

0 votes
asked Nov 10 by Rox (140 points)

Hello, thank you for an answer. Sorry, maybe I did not make myself clear. I mean that for uwp this code with Rebex.Legacy.Cryptography works fine, but my point is to transport ecrypted byte array to the web api and decrypt it there. I'm using same code in web api, but instead of Rebex.Legacy.Cryptography i'm using System.Security.Cryptography, because , it is not possible to use Rebex.Legacy.Cryptography in web api. I proceeded from the fact that Rebex.Legacy.Cryptography it is wrapping above the Windows.Security.Cryptography and should have the same logic as System.Security.Cryptography. Is it possible at all to use such approach? If no, please, could you suggest me solution. Thank you.

1 Answer

0 votes
answered Nov 10 by stepantalalayev (2,640 points)
edited Nov 10 by Lukas Pokorny

Hello, thanks for the clarification.

We have tried to reproduce the issue this way and noticed that that you might be generating different initialization vector in the UWP app and in the server app, which would return different salt at the decrypting end. This would explain the error.

When we use the same IV/salt at the server side, the process works fine - download the updated sample solution and give it a try.

If you are doing anything differently, please let us know.

commented Nov 11 by Rox (140 points)
You right, now it works, thank you!
...