opcua-asyncio icon indicating copy to clipboard operation
opcua-asyncio copied to clipboard

SecurityPolicyBasic256: confusing argument name

Open brubbel opened this issue 2 years ago • 4 comments

https://github.com/FreeOpcUa/opcua-asyncio/blob/0f4f68cdaee8a5a9ba193272876a1c7ac66937eb/asyncua/crypto/security_policies.py#L555-L556

client_pk is in fact the private key for the host certificate and as such host_pk should be a better name.

brubbel avatar Jul 10 '22 09:07 brubbel

The code is used in client and server. So it should just named privatekey or pk.

schroeder- avatar Jul 17 '22 09:07 schroeder-

Given that in the context of the client, the host_cert and client_pk are still paired, I do not agree. Maybe the use of local_cert and local_pk is better, along with peer_cert.

Anyway, peer, host and client is not very readable. peer and local is more understandable.

Please correct if I'm wrong :)

brubbel avatar Aug 03 '22 09:08 brubbel

I didn't touch all that cryto stuff, if you can provide a pr with local_cert and local_pk this would be nice. Also this is the same for other SecurityPolicys.

schroeder- avatar Aug 03 '22 10:08 schroeder-

I find "local" and "host" equally confusing. Basically, we're talking about the client application, client user, and server application certificates when encrypting messages and doing certificate-based authentication. Imagine a client that's located on the same system as the server. Then "local" and "host" are the same system. What is "peer" in that context? The server? So far, using "server", "client" and "user" has proven useful. They're near impossible to confuse. Anyhow, having the same name for key and certificate is definitely much more readable, no matter the actual name. 👍

starturtle avatar Aug 17 '22 14:08 starturtle