hohl / MIHCrypto

OpenSSL wrapper for Objective-C [cryptography]
MIT License
340 stars 66 forks source link

Export/Import keys via NSData #9

Open hohl opened 10 years ago

hohl commented 10 years ago

Allow the exporting and importing of private and public keys as files. It would be good design to add these two interface:

...providing the ability to import/export MIHPrivateKey, MIHPublicKey and MIHSymmetricKey. Every file format could be one implementation for these interfaces.

There should also be the ability to set passwords when it is supported by the file format (like it is with P12).

edele commented 9 years ago

@hohl is it possible for now at least to get NSData of generated keys?

hohl commented 9 years ago

What do you mean with NSData?

It is already possible to use toData for exporting. However at the moment you have no choice about choosing the (file) format. For example MIHRSAPublicKey will always export to "*.pub" files as you may know it from OpenSSL anyway (for example same format as used by ~/.ssh/id_rsa.pub for SSH auth).

However this issue is about moving these functionality from the domain classes itself to an exporter class. Then it would be possible to export single keys into multiple different formats. Like having a "MIHOpenSSLExporter" and a "MIHPuttyExporter".