python-sshpubkeys
python-sshpubkeys copied to clipboard
Avoid deprecated encode_point() method
- This allows
python-sshpubkeysto work withcryptography>=39.0.0. ec.EllipticCurvePublicNumbers.encode_point()had been deprecated for a long time, and was removed in commit pyca/cryptography@2b6e463 , orcryptography==39.0.0.- I manually tested to confirm that for all of the existing test cases that called
to_string(), this newpublic_bytes()method yielded the same bytes as the oldencode_point(). - Since the "compressed"
to_string()was already usingpublic_bytes()withEncodingandPublicFormat, it seems unlikely that this change will break support for any versions ofcryptography
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?