Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for server-side ephemeral keys #298

Open
petrdvorak opened this issue Oct 30, 2019 · 3 comments
Open

Add support for server-side ephemeral keys #298

petrdvorak opened this issue Oct 30, 2019 · 3 comments

Comments

@petrdvorak
Copy link
Member

Currently, we use an ECIES algorithm with fixed keys (master server public key, device public key) that are stored on the mobile device and client-side ephemeral keys. This is good, but we could also add support for the server-side ephemeral keys (let's call them "temporary keys" here).

Gist

Temporary Public Key Exchange

  • The client asks the server for an ephemeral key, sending a random nonce as a "request ID".
  • The server generates a temporary keypair and it responds to the client with the request ID, temporary public key and signature of both public key and request ID computed with a master secret private key (or device private key).
  • The client verifies that the request ID matches the expected value and then verifies the signature (to prove authenticity of the public key).

=> Client now has a new one-time public key

Temporary Key Pair Storage on Server-Side

Server (probably PA Server) should store temporary keys in a separate table, such as pa_temporary_keypair. Each record should be one-time-only (when used, it should invalidate) and should have short expiration (to allow the cleanup).

Encrypting Request and Response

The encryption/decryption works the same way as for our current ECIES. The temporary key should be invalidated once the encrypt/decrypt cycle is completed.

@romanstrobl
Copy link
Member

I suggest we look at ECDHE_ECDSA in RFC 4492: https://tools.ietf.org/html/rfc4492, the TLS 1.2 specification defines a similar protocol for authentication of a public key.

@romanstrobl
Copy link
Member

In particular, section 5.4 defines the data being signed by ECDSA:
image

@petrdvorak
Copy link
Member Author

To add one more comment to this topic. The improvement will provide us with:

  • Forward secrecy in use cases where we currently do not have it.
  • Improved compliance with requirements on short key lifetime and limited key reuse.
  • Improved compliance with requirements on one-purpose-specific keys.
  • Even more improved protection from replay attacks (as the key itself will be one-time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants