Good day! There was a question to fasten authorization on a site through esia (Gosuslugi). Surely someone has already done this! Help please, I am very far from this, but I have to do it ...
In general, there is a site on ASP.NET (c #, Windows Forms).
The selected authentication type is OAuth 2.0 and OpenID Connect 1.0.
Already, as indicated, on the website of the Ministry of Communications and Mass Communications formed an application for connection to the ESIA test environment. Approved the application, sent a document with the instruction and 3 files. There are no steps in the tool as such, only logins and passwords for entering public services are test ones and a description of what should come in response.
Files of type .rar - according to the instructions, they are supposedly containers with keys for EDS. for example, the archive EsiaTest.006.rar contains the following files:
- header.key
- masks.key
- masks2.key
- name.key
- primary.key
- primary2.key
All parameters for authorization, in principle, are clear, except just the signature. That's just the formation of EDS I have problems.
The document says to form it like this:
Signature of the request in the PKCS # 7 format detached signature in UTF-8 encoding from the values of the four parameters of the HTTP – request: scope, timestamp, clientId, state (I have them). The signature must be encoded in base64 url safe format. The certificate used to verify the signature must be previously registered in the ESIA and linked to the account of the client system in the ESIA. ESIA supports X.509 certificates. ESIA supports RSA electronic signature generation algorithms with a key length of 2048 and SHA-256 cryptographic hashing algorithm, as well as the GOST R 34.10-2001 electronic signature algorithm and the GOST R 34.11-94 cryptographic hashing algorithm.
Help form this signature! How to implement all this on c #? Thank you in advance