-
Notifications
You must be signed in to change notification settings - Fork 351
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
Allow exporting the data back from PublicKey and PrivateKey #60
Comments
This is a great idea. Exposing the key data is definitely an easy thing to do, we'll need to make sure that users understand that the data is not the exact data that was provided when creating the key – since we strip the headers when adding to the iOS keychain. We could potentially have As for PEM/DER, this is definitely something we can have too and that doesn't seem too hard to implement. PEM is just the key data in base64 with a header + footer, DER is raw bytes (so you could just use the I'm tagging this issue as |
Thanks very much for your quick reply! If you're short on time, you may also consider making it an open class (so that people can write extensions to it) or making some read-only properties public (e.g. 'reference' and 'tag' of the PublicKey). (The latter would make it possible to extract the data from SecKey with third party code.) |
@serieuxchat With 5485e6a , SwiftyRSA now gives you readonly access to
I'll incrementally add support for exporting to PEM/DER and init with a SecKey. Thanks a lot for your patience! |
@serieuxchat I PR'd some code that adds support for |
Thanks a lot! We will give it a try. |
@serieuxchat Good news! SwiftyRSA 1.1.0 has been pushed to cocoapods and now allows exporting data from a private or public key. Let me know if you run into any issue! Closing this now |
Currently we can instantiate, e.g., a PublicKey with Data or a PEM string, but we cannot get these representations back if we already have a PublicKey.
It would be very useful if it were possible to at least get the raw data back.
The text was updated successfully, but these errors were encountered: