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

Basic authentication is not really possible to get working with manually-issued certs #237

Open
xefinity opened this issue Jun 14, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@xefinity
Copy link

From my quick look at code, i found out that there is key exchange public key signing in source, but no way to set keys for it are provided in the interface. (It is possible to set them through certificates, but certificates don't look like they are made for usage outside Steamworks).
And my question is: can i set keys for signing and verifying key exchange public keys using only interface?
If no, i think it's worth considering adding some simple API for that, for example:

AddKeyExchangePublicKeys(CECSigningPublicKey* keys, size_t keyCount);
SetKeyExchangePrivateKey(CECSigningPrivateKey key);

(CECSigningPublic/PrivateKey are here for example)
I think, it will improve protection against MITM.

@zpostfacto
Copy link
Contributor

Sorry, what exactly do you want to do?

The certificate format is proprietary (it is not X509), but the framework is pretty standard stuff. There are methods to set a particular certificate, and a certificate tool, if you want to generate one.

Also, just to clarify, the Diffie-Hellman key exchange is always done with ephemeral keys. The keys used for signing have longer lifetimes. What was your goal in specifying a particular key to use for key exchange?

@xefinity
Copy link
Author

xefinity commented Jun 15, 2022 via email

@zpostfacto
Copy link
Contributor

zpostfacto commented Jun 15, 2022

There is a basic cert store, and a certificate generation tool. And you can hardcode a particular trusted root AC key by #defining STEAMNETWORKINGSOCKETS_HARDCODED_ROOT_CA_KEY. However, I suspect there might be some missing pieces, depending on your use case. I can think of at least three:

1.) The cert tool actually doesn't have a way to specify the identity that should go into the cert.
2.) There isn't an easy way to tell the library to use a particular private key and cert.
3.) There isn't really an API for adding intermediate certs into the cert store.

Each of those would be really easy to add, though. All of the stuff under the hood is present, there just isn't the exact API call you need.

NOTE: It might seem kinda weird that these don't exist to handle the "typical" use case, but it actually hasn't come up, because all of the certificate issuance in Steam and partners is all automated! We never issue certificates by hand.

One thing that would be quite a lot of work to fix is that, unlike TLS, we do not send intermediate certs in the handshake. We require that both sides have all required intermediate certs. So if you are using any intermediate certs you need to make sure they are distributed. If you only have a single root CA, then you just hardcode the trusted key.

If you tell me more about your use case, I might be able to point you in the right direction if you are interested in adding those missing pieces. Again, I think it would be pretty easy, as everything under the hood is present, there just isn't the highest level API entry point to do exactly what you need.

@xefinity
Copy link
Author

xefinity commented Jun 15, 2022 via email

@zpostfacto zpostfacto changed the title Is there a way to provide keys for signing and verifying key exchange public keys? Basic authentication is not really possible to get working with manually-issued certs Jun 16, 2022
@zpostfacto zpostfacto added the enhancement New feature or request label Jun 16, 2022
@zpostfacto
Copy link
Contributor

I changed the title to clarify what is needed here. If I have some time I'll add the needed features.

I don't think there's anything unusual your use case, it seems like an entirely normal situation. It's actually kind of surprising that nobody has complained about this not being possible before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants