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

Load .pem from assets #4

Closed wyklif closed 4 years ago

wyklif commented 4 years ago

How would you load a .pem file to use for asymmetric encryption from the assets directory?

AKushWarrior commented 4 years ago

I'm sorry for the late response, as I've been busy lately. As of right now, there is no way to do this. However, I am working on a way to get this done; as soon as I'm finished, I'll get back to you with details.

AKushWarrior commented 4 years ago

I finished the update. By updating the package to 1.3.0+, you'll get access to the new

Future<T> parseKeyFromFile<T extends RSAAsymmetricKey>(String fileName)

method in RsaCrypt, which returns the relevant RSA key given a file path to a PEM file.

It would look something like this in practice:

var crypt = RsaCrypt();
RSAPrivateKey privKey = await crypt.parseKeyFromFile<RSAPrivateKey>("filepathhere");
return crypt.encrypt("mytexthere", privKey);

Lemme know if anything goes wrong; nothing showed up in my tests, but it's very possible I missed a case. I'm closing this for now.

AKushWarrior commented 4 years ago

@wyklif I closed this. If you have any problems whatsoever, please let me know.

wyklif commented 4 years ago

Thank you sir,  

Sent from Yahoo Mail on Android

On Wed, Sep 25, 2019 at 4:18, AKushWarriornotifications@github.com wrote:
I finished the update. By updating the package to 1.3.0+, you'll get access to the new Future RsaCrypt().parse(String fileName) method, which returns the relevant RSA key given a file path to a PEM file.

Lemme know if anything goes wrong; nothing showed up in my tests, but it's very possible I missed a case. I'm closing this for now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.