The scenario: a device signs a challenge before receiving a session
A shared device can use a challenge signature to demonstrate an operation with the private key corresponding to its registered public key. That cryptographic result does not independently decide which clinic may approve the device, which capabilities it receives or whether the challenge remains valid. Those questions require authoritative state.
One earlier server-helper case passed with ephemeral keys and random synthetic nonces. Thirteen additional native display JVM cases now cover selected public vectors and an actual loopback mock HTTP exchange. These separate local fixtures do not establish current server/database or installed-device acceptance.
Define the accepted public-key representation
The reviewed public-key parser accepts the intended base64 SPKI DER representation, imports the key and checks the selected EC curve. It exports a canonical form of the expected shape rather than treating any parsable key as interchangeable.
The selected fixture accepts its generated P-256 public key and refuses a different EC curve, an Ed25519 key and malformed text. Those are useful interoperability and refusal examples. They do not establish the source of a real key or whether its private half is protected. Public-key syntax and physical-device identity remain distinct properties.
Sign the raw nonce bytes under the agreed encoding
The token route decodes the accepted nonce representation into bytes before calling the signature helper. The helper verifies the expected signature format over that nonce. The selected fixture signs random raw bytes and checks successful verification with the corresponding public key.
A client that signs the base64 text instead of the decoded bytes, or produces a different signature encoding, is not following this same contract. Device acceptance should record the actual platform output and input bytes using synthetic challenges. This review does not run Android Keystore or an iOS key adapter; the source comment naming a platform is not a substitute for that evidence.
Test wrong-message and wrong-key failures separately
The helper fixture reuses the original signature with a different nonce and checks refusal. It also signs with another generated private key and checks refusal against the original public key. A malformed short signature is refused as a separate representation case.
These checks establish selected local cryptographic behaviour. They do not prove challenge freshness, device ownership or permission to open a session. A captured valid signature for a synthetic nonce is only meaningful within the authoritative challenge lifecycle. The protocol needs both correct verification and the service rules that decide which challenge may be consumed.
Keep pairing requests separate from approved device authority
The inspected pairing route accepts selected device metadata and the parsed public key, then asks the responsible service to create a pairing request. It returns the resulting request information and a polling capability. The request does not supply an arbitrary final capability list to be trusted by the token issuer.
That source path describes request creation, not completed staff approval. The selected cryptographic fixture does not execute it. A full acceptance should inspect who may approve a synthetic request, which clinic context is assigned and how an expired or refused request is represented. Creating a pairing request must not be confused with an operating device grant.
Trace challenge consumption before session issuance
The reviewed token route calls the authoritative challenge-consume operation before verifying the signature against the returned public key. It opens a session only after the helper accepts the signature, and obtains kind and capabilities from the session result for token construction.
That establishes the inspected call order. It does not independently prove single-use database semantics or transactional behaviour under two competing requests. Those need integration tests against the responsible service. Include an incorrect signature, a repeated challenge and a failure between consume and session-open so the accepted recovery is defined rather than inferred from an operation name.
Cross-check the native signature representation with public fixtures
Three additional JVM cases check a public key-fingerprint vector, a recorded DER ECDSA signature over decoded nonce bytes and the selected P-256 SPKI representation generated by a software signer. The fingerprint fixture compares the short display fragment with its recorded expected format; it is not a full human pairing or key-ownership ceremony.
Ten local mock-HTTP cases then exercise the native display session and adapter against invented endpoints and ephemeral signing material. The mock consumes its generated nonce and verifies the synthetic signature. This cross-layer fixture is useful evidence about the client’s bytes and request shape, but it does not execute the actual server/database challenge implementation or inspect Android hardware key storage.
Refresh a refused exchange without treating every error as revocation
The selected mock cases exercise one fresh challenge after a refused token exchange and one token refresh after an authenticated call returns 401. Another case observes reuse of the selected memory-cached token. Rate-limited and unavailable responses carry their selected error information; capability denial is not classified as device revocation. These distinctions prevent a generic request failure from being described as a reason to erase pairing state.
A separate selected case receives a typed revoked response and explicitly calls the session wipe operation, then checks the in-memory device state, software key and token. That is not proof that every engine path automatically performs a durable wipe. Missing software-key and revoked-challenge fixtures also produce the selected typed refusal; physical key loss and real device recovery remain separate acceptance.
Inspect the HTTP envelope as well as the cryptographic payload
The local adapter cases additionally inspect selected snapshot validator/since handling, heartbeat decoding, omission of null heartbeat text, an empty acknowledgement body and parsed stream events with the selected resume/header shape. Those are actual loopback HTTP requests to a mock server, not current Movo-X provider traffic.
The mock supplies its own error bodies, timestamps, access tokens and responses. Passing its contract does not establish TLS configuration, real gateway limits, complete protocol conformance or authorization of a live clinic. Keep these thirteen cases alongside the earlier server-helper case and add isolated authoritative-server, database and approved-device checks before claiming full device enrollment and session acceptance.
Do not turn a signature test into a hardware-security claim
The fixture generates keys inside the local test process. It does not demonstrate secure-element storage, nonexportability, attestation, physical possession or protection after a device is stolen. A valid signature is evidence about a key operation under the tested cryptographic inputs, not a complete statement about the device that requested it.
A deployment acceptance should separately review platform key storage, reset/re-pair behaviour and how the authoritative service revokes a device. Use an approved synthetic device and safe diagnostics. This chapter publishes no real public-key registration, private key, challenge, polling capability or session credential.
A concrete challenge-authentication handover
Deliver the public-key format, curve, nonce bytes, signature encoding and challenge/session sequence. Attach wrong-key, wrong-nonce and unsupported-format fixtures. Add authoritative expiry, replay, approval, revocation and platform-key-storage tests as named independent evidence.
For a CTO, that makes device authentication reviewable without conflating its layers. A parser recognizes a key, a signature verifier checks an operation and the service decides whether the device may receive a session. The pinned source and selected local test support the cryptographic boundary while actual clinic permission and device custody retain the operating evidence they require.
Compare the reviewed boundaries
Separate challenge authentication from surrounding authority
On smaller screens, scroll across to compare every column. Keyboard users can focus the table and use the arrow keys.
| Boundary | Selected evidence | Separate acceptance |
|---|---|---|
| Signature bytes | Earlier server helper and public-vector JVM cases | Actual key custody and signed-device build |
| Native exchange | Ten loopback mock-HTTP cases | Real server/database nonce consumption |
| Failure response | Selected refresh and typed-error fixtures | Engine lifecycle and durable wipe |
| Pairing permission | Selected server route source | Current staff approval and device scope |
Illustrative control flow
Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.
public_key = parse_accepted_public_key_representation(pairing_request)
challenge = authoritative_consume_for_device(device_id, decoded_nonce_bytes)
if not verify_signature(challenge.public_key, decoded_nonce_bytes, signature):
refuse_session()
session = authoritative_open_session(challenge)
issue_token_with_service_selected_kind_and_capabilities(session)
# Verification, challenge lifecycle, staff approval and hardware custody are separate evidence.About this engineering series
Written by Omer Muneer Qazi from a review of Movo-X implementation and dated engineering records. This article explains source behaviour and historical observations; current production, clinical outcomes and store availability require their own verification. Examples are synthetic and proposed test cases are identified as such.
Explore the Movo-X engineering series → · Related implementation experience →
Discuss a similar engineering problem
Send the workflow, current platform and the decision your team needs to make. I can help define an implementation or review scope with concrete acceptance evidence.
Discuss your project on WhatsApp ↗