Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export individual public or private key? #8

Closed
franks42 opened this issue Jun 30, 2015 · 8 comments
Closed

export individual public or private key? #8

franks42 opened this issue Jun 30, 2015 · 8 comments

Comments

@franks42
Copy link

When I generate a key-pair with:

k = jwk.JWK(generate='EC', crv='P-256', use='enc', kid='9876543210')

I'd like to "export" the public key in json format to communicate it to other parties. My understanding from reading the example code and API was, that I could possibly do that with:

pk = k.get_op_key('encrypt')
pk_json = pk.export()

but that doesn't work: "AttributeError: '_EllipticCurvePublicKey' object has no attribute 'export'"

Couldn't find any explicit example of this in the test code. Maybe I am missing something?
Thanks for the help - Frank.

@simo5
Copy link
Member

simo5 commented Jun 30, 2015

k.export_public() is not ok ?

@franks42
Copy link
Author

k.export_public() is ok.

Thanks - should learn not to trust the doc and look at the code before asking Qs ;-)

@simo5
Copy link
Member

simo5 commented Jun 30, 2015

If it is not doc-ed that's a bug ... indeed it is.

@simo5 simo5 reopened this Jun 30, 2015
@simo5
Copy link
Member

simo5 commented Jun 30, 2015

Reopening, will use to track doc bug.

@franks42
Copy link
Author

Appreciate the near instant, real-time support!

On Tue, Jun 30, 2015 at 10:26 AM, simo5 notifications@github.com wrote:

Reopening, will use to track doc bug.


Reply to this email directly or view it on GitHub
https://github.com/simo5/jwcrypto/issues/8#issuecomment-117269773.

@franks42
Copy link
Author

Not sure if it's a bug, but the exported public key lost the kid-attribute that was set on the generated key-pair.

@simo5
Copy link
Member

simo5 commented Jun 30, 2015

It's a bug.

@simo5
Copy link
Member

simo5 commented Jun 30, 2015

Fixed with 9d52a18
Also the "stable" docs had export_public() documentation, but the default docs were going to the "latest" tag on readthedocs, but it is unclear why that tag had no documentation. Will investigate and fix that.
Thanks a lot for reporting these issues.

@simo5 simo5 closed this as completed Jun 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants