Hi! I don't know if this is the best place for questions. If not feel free to close this.
I am implementing TLS authentication between two peers. On each peer I generate a Certificate and serialize it to disk with cert.serialize_private_key_pem().
Later I exchange peers' certificates cert.serialize_der() and then use rustls for establishing TLS session.
Everything works out well. The problem I am having is that I want to generate a hash (unique peer ID) from public certificate and keep it the same for each peer on each run. I've noticed that every time I call cert.serialize_der() it generates a slightly different output.
It seems that underlying key pair's public key remains the same so I can consistently generate a hash on each peer but then when TLS session is established I would like each peer to generate hash again from rustls::Session::get_peer_certificates().
What am I missing? What should I use as an input for hash generation? Is KeyPair::public_key_der() a good candidate? If yes, how do get it from rustls::Session?
My issues are most likely due to the lack of knowledge about certificates and encryption in general.
Hi! I don't know if this is the best place for questions. If not feel free to close this.
I am implementing TLS authentication between two peers. On each peer I generate a
Certificateand serialize it to disk withcert.serialize_private_key_pem().Later I exchange peers' certificates
cert.serialize_der()and then userustlsfor establishing TLS session.Everything works out well. The problem I am having is that I want to generate a hash (unique peer ID) from public certificate and keep it the same for each peer on each run. I've noticed that every time I call
cert.serialize_der()it generates a slightly different output.It seems that underlying key pair's public key remains the same so I can consistently generate a hash on each peer but then when TLS session is established I would like each peer to generate hash again from
rustls::Session::get_peer_certificates().What am I missing? What should I use as an input for hash generation? Is
KeyPair::public_key_der()a good candidate? If yes, how do get it fromrustls::Session?My issues are most likely due to the lack of knowledge about certificates and encryption in general.