AKushWarrior / steel_crypt

A collection of high-level API's exposing PointyCastle to perform hashing and encrypting in popular/secure algorithms.
https://pub.dev/packages/steel_crypt
Mozilla Public License 2.0
40 stars 10 forks source link

Feature suggestion: encoding to PEM #8

Closed KenV1040 closed 4 years ago

KenV1040 commented 4 years ago

After having read the documentation, I don't think you have a method to encode public and private key to PEM and storing it as a string. Is it possible to add this? I'd like to use this feature so I can store it in FlutterSecureStorage since it only accepts strings.

AKushWarrior commented 4 years ago

I'll try to figure out a way to do this. Right now, I think JSON string encoding/decoding might be the easiest way to do this, but I'll take a look at PEM, since PEM is more standardized.

KenV1040 commented 4 years ago

Alright, thanks for the suggestion. I'll check it out!

AKushWarrior commented 4 years ago

Right, so I can definitely make PEM encoding work. I'm unit testing now, but PEM encoding will be in the main lib within the next few hours.

AKushWarrior commented 4 years ago

The update (which is not on github yet, I have some versioning stuff to work out) is now on pub. To convert a key to a PEM string, use

RsaCrypt().encodeKeyToString(RsaAsymmetricKey KeyHere)

To get a key back from a PEM string, use

RsaCrypt().parseKeyFromString(String PemStringHere)