[HUB - ERROR] AES 256 bits rinjdael crypto security with binnary formatter fails on authorization attribute override - Class level
Hello community.
I'm having an issue when I protect hub methods on class level with "AuthorizeAttribute" with an override of the methods.
I'm using AES 256 bits with rinjdael and binnary formatter to make data secure on connection token and other data that's travel from client to server. The first time that's doing the decryption there isn't any problem, but when it's going to decrypt the second time and more times after it, the error of "Padding is invalid and cannot be removed" starts to showing up without stopping.
I've done unit tests passing with several tests of this behaviour to see if it fails but it doesn't.
I'm attaching the log file that's logging the errors at Application_Error of global.asax under "AppDomain.CurrentDomain.FirstChanceException" and "AppDomain.CurrentDomain.UnhandledException".
Regards,
Jose Luis Guerra Infante.
New information.
When is the first attempt, the value that I'm retrieving from IRequest (request.QueryString.Get("ConnectionToken")) is 3í¸dÕÐà\u0094Áïêhe.|\u0088i=\rkëõÖE½j^ÆVõYS¬?ñ4òd\u001c`/¾Þ/t\n\b\u000ez>Ñ(®ÅGj\u0014ä\u009e\u0091ùGð× and after the first attempt to grant permissions to other hub methods then is ukGGwQEKj8HrlzKJ5GQ6mWAE6BJggCzjFV0e+Nsdc11OirGgXQB1/HE/68HQxiiXjhbRiWS/2JqX+Ua6pRwzKZifrIcB9BCMwGI9zs4rJ+owZjzg63EsBJ6MpiTramDd and this is failing, the first one is 64 bits and the second one are 128 bits, I don't know why happens I'm investigating when I've enough time to do it... If somebody can give me a hand where to look, I'll appreaciate the info.
Note: From client is the first call and signalR do It's magic to grant permissions several times on "AuthorizeHubConnection" so to best understanding in resume:
- One call from signalR client (Authentification)
- Several server internal calls to grant authorization to hubs on first request.
- After the first attempt all the other authorizations fails and there's a changing on the specific value that I'm sending encrypted on AES.
This issue has been closed as part of issue clean-up as described in https://blogs.msdn.microsoft.com/webdev/2018/09/17/the-future-of-asp-net-signalr/. If you're still encountering this problem, please feel free to re-open and comment to let us know! We're still interested in hearing from you, the backlog just got a little big and we had to do a bulk clean up to get back on top of things. Thanks for your continued feedback!