konstantinullrich / crypton

A simple Dart library for asymmetric encryption and digital signatures
https://pub.dev/packages/crypton
MIT License
34 stars 12 forks source link

Can we generate RSA public key from PEM? #22

Closed adonese closed 3 years ago

adonese commented 3 years ago

Currently the library only generates a random RSA key and use it for encryption. Some use cases (my current use case) relies on an existing rsa public key, and the idea is to use the existing public key to encrypt a message.

Can this use case be supported? Thanks!

konstantinullrich commented 3 years ago

Technically you could use the RSAPrivateKey.fromString Function for that. But I could add a .fromPEM function.

adonese commented 3 years ago

Unfortunately, i'm not that good in dart / flutter -- and you can correct me if i'm wrong. This library is testable by flutter test and unlike other libraries, it doesn't rely on OS specific functionality for that.

That's why i think it is cool, plus also the simple API too!

PS. Can that by RSAPublic.fromString()?

On Mon, Jan 4, 2021 at 9:56 PM Konstantin Ullrich notifications@github.com wrote:

Technically you could use the RSAPrivateKey.fromString Function for that. But I could add a .fromPEM function.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/konstantinullrich/crypton/issues/22#issuecomment-754183259, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJ2GNBEPQ5DRLM3D66JPRTSYIMNDANCNFSM4VTMJOFQ .

konstantinullrich commented 3 years ago

No worries, I created this lib to make Encryption easy and accessible for everyone :)

Yes, thanks to Dart this lib is platform-independent. To test this lib you simply clone the repo and run pub test

To create a public key using a string you could use RSAPublic.fromString()

You can also look at the API Dokumentation for more information.

adonese commented 3 years ago

So great! I used RSAPublic.fromString() and it just worked!