tlsfuzzer / python-ecdsa

pure-python ECDSA signature/verification and ECDH key agreement
Other
914 stars 315 forks source link

export to ssh #323

Closed pmazzini closed 1 year ago

pmazzini commented 1 year ago

Initial support for exporting keys in the SSH format as requested in #111. For now it only supports Ed25519 curves but it shouldn't be hard to add additional ones.

tomato42 commented 1 year ago

IIRC, openssh supports only 4 or 5 curves (P-256, P-384, P-521, Ed25519, Ed448), I see no reason not to support all of them...

beldmit commented 1 year ago

IIRC, openssh supports only 4 or 5 curves (P-256, P-384, P-521, Ed25519, Ed448), I see no reason not to support all of them...

Not sure about Ed448

pmazzini commented 1 year ago

test coverage missing

I am happy to add some tests if you think the code is looking ok-ish.

pmazzini commented 1 year ago

Not sure about Ed448

Yeah, there is no support for Ed448 yet.

tomato42 commented 1 year ago

test coverage missing

I am happy to add some tests if you think the code is looking ok-ish.

yes, the code looks ok-ish, but python 2.6 compat and test coverage is mandatory, I won't merge the code otherwise.

pmazzini commented 1 year ago

Added unit tests. CI for Py 2.x was working fine.

tomato42 commented 1 year ago

you will need to use methods from https://github.com/tlsfuzzer/python-ecdsa/blob/master/src/ecdsa/_compat.py for py2 compat

pmazzini commented 1 year ago

Switched to compat int_to_bytes.

pmazzini commented 1 year ago

Switch to using der.topem() and fix it while on it. Use a line break every 76 bytes: https://docs.python.org/3/library/base64.html#base64.encodebytes

pmazzini commented 1 year ago

Use compat26_str in der.topem().

pmazzini commented 1 year ago

More compat26_str.

pmazzini commented 1 year ago

Fix typo.

pmazzini commented 1 year ago

Any blocker for merging? :)

tomato42 commented 1 year ago

Any blocker for merging? :)

yes, my time to do a final review :)

thanks for the PR!