Guest mode. You can read posts without signing up. Comments, ratings, job contacts and your own posts open after you sign up and accept the rules. What is Kommit →

Редакция КоммитРедакция портала
commit 5a399c0 · 19 days ago

EDS and NCALayer, Part 2: Signature in the browser via NCALayer

🌐 Machine-translated from Russian. Show original

⚖️ Rules are changing. The post is an overview of official sources as of November 2026, not a legal or tax consultation. Before making a decision, check with current editorial offices and a lawyer.

In this part:

What is NCALayer#

NCALayer is a NCALayer application for the NCC RK that the user installs on the computer. The browser itself cannot work with digital signature keys, so the site communicates with NCALayer via a local WebSocket connection: it transmits data for the signature, NCALayer shows the user a window for selecting the key and entering the password and returns the signature.

The private key and password do not reach your site — this is an important security feature.

How the interaction works#

  1. The page opens the WebSocket to NCALayer on the user's computer.
  2. Sends a request: which module and method to call, which data to sign, and with what parameters.
  3. NCALayer shows a window: storage selection, key, password entry.
  4. Returns the result — a signature in CMS format or signed XML.
  5. The page sends the signature to your server, where it is always checked (part 3.

Client library#

There is no need to write the protocol manually: for JavaScript, there are open client libraries for NCALayer that wrap WebSocket and signature methods. Sample logic on the page:

// псевдокод: конкретные имена методов — в документации выбранной библиотеки
const client = new NCALayerClient();
await client.connect();                       // локальное соединение с NCALayer
const cms = await client.signCms({
  data: base64Data,                           // данные для подписи
  keyType: "SIGNATURE",                       // ключ с назначением «подпись»
  attached: false,                            // отделенная подпись
});
await fetch("/api/documents/123/sign", { method: "POST", body: JSON.stringify({ cms }) });

Login to the website via digital signature#

Classic scheme:

  1. The server generates a one-time random string (challenge) and stores it with a short lifespan.
  2. The browser signs it with the user's key through NCALayer (since 2024, this is a single GOST 2015 key; older keys have an AUTH authentication key).
  3. The server checks the signature, challenge match, deadline, certificate revocation, and retrieves IIN/BIN from the certificate.
  4. Finds or creates a user using IIN.

Without a one-time challenge, the signature can be intercepted and reused.

UX: what annoys users#

  • NCALayer is not running — show a clear message and installation link, not a "WebSocket error."
  • The wrong key was chosen — the old model keys had separate AUTH keys and signatures: please immediately tell me which one is needed. The new GOST 2015 key is suitable for both cases.
  • Certificate has expired — warn in advance if you see an upcoming expiration date.
  • Long wait — after submitting the request, the NCALayer window may open behind the browser; please advise the user.

Security#

  • Sign what the user sees: the hash or the content of the document shown on the screen, not arbitrary data.
  • Never trust the result of the "client" verification — only on the server.
  • Do not ask the user for a key file and password in a web form: this is a direct path to key theft.

Next — signature verification on the server.

Comments 00 участников · 1 гость🔒 Rate and discuss after signing up

Comments · 0

No comments yet.Sign in to comment, rate and see all comments.