python-sshpubkeys icon indicating copy to clipboard operation
python-sshpubkeys copied to clipboard

Avoid deprecated encode_point() method

Open byebrid opened this issue 1 year ago • 0 comments

  • This allows python-sshpubkeys to work with cryptography>=39.0.0.
  • ec.EllipticCurvePublicNumbers.encode_point() had been deprecated for a long time, and was removed in commit pyca/cryptography@2b6e463 , or cryptography==39.0.0.
  • I manually tested to confirm that for all of the existing test cases that called to_string(), this new public_bytes() method yielded the same bytes as the old encode_point().
  • Since the "compressed" to_string() was already using public_bytes() with Encoding and PublicFormat, it seems unlikely that this change will break support for any versions of cryptography

Pending question about test cases

All of the unit tests still pass with python -m unittest tests.

I was unsure whether I should try adding unit tests for these to_string() methods or not. Since I'm not super familiar with cryptography, I would simply have based any expected values off of whatever was already being produced by the to_string() methods. I don't think is the best way of writing tests. But, this would also at least guarantee that any future changes do not change the output of to_string(), so perhaps it is still worth it?

byebrid avatar Dec 23 '24 23:12 byebrid