rsa 0.0.2 copy "rsa: ^0.0.2" to clipboard
rsa: ^0.0.2 copied to clipboard

Dart 1 only

A library providing a simple to use RSA interface

rsa #

Build Status Coverage Status

This library provides an easy to use interface for rsa en- and decryption.

Warning: This implementation has not been tested in production nor has it been examined by a security audit. All uses are your own responsibility.

Usage #

To obtain a KeyPair instance, one can call KeyPair.parse(String pem, {String password}). This parses the given pem string and creates a KeyPair instance with all keys contained in this string.

Encryption and Decryption #

KeyPair.encrypt and KeyPair.decrypt accept two input types:

  • String
  • Uint8List.

The same applies for KeyPair.sign and KeyPair.verify. If you want to encrypt and sign something, simply call KeyPair.publicEncrypt. This encrypts the given argument and signs the generated cipher. The output is a PublicEncryptionResult.

To decrypt and also verify the given PublicEncryptionResult, call KeyPair.privateDecrypt. If the signature cannot be verified, this throws an Error. otherwise, it returns the decrypted (if possible) message.

All methods work as described in the PKCS1 Standard, as default they also apply the standard PKCS1-Padding.If you don't want to use padding, simply set padding to null. The default hash method for EMSA_ENCODE is SHA256, currently only SHA256, MD5 and SHA1 are implemented.

Help and pull requests are always appreciated!

0
likes
10
points
5
downloads

Publisher

unverified uploader

Weekly Downloads

A library providing a simple to use RSA interface

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

asn1lib, bbs, bignum, crypto, rsa_pkcs

More

Packages that depend on rsa