pub repository
mirror.p-hatan.compointycastle
1.0.0-rc1A Dart library implementing cryptographic algorithms
Readme
Pointy Castle
A Dart library for encryption and decryption. As of today, most of the classes are ports of Bouncy Castle from Java to Dart. The porting is almost always direct except for some classes that had been added to ease the use of low level data.
To make sure nothing fails, tests and benchmarks for every algorithm are provided. The expected results are taken from the Bouncy Castle Java version and also from standards, and matched against the results got from Pointy Castle.
Algorithms
As of the last release, the following algorithms are implemented:
Block ciphers:
- AES
Asymmetric block ciphers:
- RSA
Stream ciphers:
- Salsa20
Block cipher modes of operation:
- CBC (Cipher Block Chaining mode)
- CFB (Cipher Feedback mode)
- ECB (Electronic Code Book mode)
- GCTR (GOST 28147 OFB counter mode)
- OFB (Output FeedBack mode)
- CTR (Counter mode)
- SIC
Paddings:
- PKCS7
Digests:
- MD2
- MD4
- MD5
- RIPEMD-128
- RIPEMD-160
- RIPEMD-256
- RIPEMD-320
- SHA-1
- SHA-224
- SHA-256
- SHA-3
- SHA-384
- SHA-512
- SHA-512/t
- Tiger
- Whirlpool
MACs:
- HMAC
Signatures:
- (DET-)ECDSA
- RSA
Password based key derivators:
- PBKDF2
- scrypt
Asymmetric key generators:
- ECDSA
- RSA
Secure PRNGs:
- Based on block cipher in CTR mode
- Based on block cipher in CTR mode with auto reseed (for forward security)
- Based on Fortuna algorithm
Usage
There are two ways to use the algorithms that PointyCastle provides: with or without using the registry.
Registry
The registry allows users to easily instantiate classes for the algorithms using the algorithm shorthands like given in the list above. It also makes it possible to seamlessly chain different algorithms together. For example:
import "package:pointycastle/pointycastle.dart";
void main() {
Digest sha256 = new Digest("SHA-256");
// or
KeyDerivator derivator = new KeyDerivator("SHA-1/HMAC/PBKDF2");
}
Without the registry
Using the registry means that all algorithms will be imported by default, which can possibly increase the compiled size of your program. To avoid this, it is possible to import algorithms one by one. In that case, you can decide to either use the classes directly, or still use the registry. But remember that the registry only contains the classes that you import. For example:
import "package:pointycastle/api.dart";
import "package:pointycastle/digests/sha256.dart";
import "package:pointycastle/digests/sha1.dart";
import "package:pointycastle/macs/hmac.dart";
import "package:pointycastle/key_derivators/pbkdf2.dart";
void main() {
Digest sha256 = new SHA256Digest();
// or
KeyDerivator derivator = new PBKDF2KeyDerivator(
new HMac(new SHA1Digest(), 64));
// But the registry keeps working for all imported algorithms:
Digest sha256 = new Digest("SHA-256");
// or
KeyDerivator derivator = new KeyDerivator("SHA-1/HMAC/PBKDF2");
}
Without dart:mirrors or package:reflectable (Flutter)
Because the registry uses reflectable to register all imported algorithm classes
and reflectable imports dart:mirrors, using the registry depends on the ability
to import mirrors. Since the Flutter frame work
doesn't allow using dart:mirrors,
it's not possible to use the registry with Flutter.
The way to use Pointy Castle in Flutter is the way explained in the previous section. However, there is a utility library that exports all available algorithms at once.
import "package:pointycastle/export.dart";
void main() {
Digest sha256 = new SHA256Digest();
// or
KeyDerivator derivator = new PBKDF2KeyDerivator(
new HMac(new SHA1Digest(), 64));
}
Libraries
package:pointycastle/pointycastle.dart: exports the high-level API and the registry loaded with all available implementationspackage:pointycastle/api.dart: exports the high-level API and the registry without any implementationspackage:pointycastle/export.dart: exports the API and all implementation classes
Changelog
Changelog
Version 1.0.0-rc1 (2018-05-28) (Dart SDK version 2.0.0-dev.57)
- Support Dart 2 and Strong Mode
- Migrate from
package:bignum.BigIntegertodart:core.BigInt - Remove Quiver and fixnum dependency
Version 0.10.0 (2016-02-04) (Dart SDK version 0.14.0)
-
First Pointy Castle release.
-
Reorganised file structure.
-
Completely new Registry implementation that dynamically loads imported implementations using reflection. It is explained in this commit.
-
Migrated from unittest to test package.
cipher releases
Version 0.8.0 (2014-??-??) (Dart SDK version ???)
- [bug 80] PaddedBlockCipher doesn't add padding when data length is a multiple of the block size. This fix introduces a BREAKING CHANGE in PaddedBlockCipher specification. Read its API documentation to know about the changes.
Version 0.7.0 (2014-03-22) (Dart SDK version 1.3.0-dev.5.2)
-
[enh 15] Implement stream cipher benchmarks.
-
[enh 64] Benchmark and optimize digests.
-
[enh 74] Make SHA-3 usable in terms of speed.
-
[bug 67] Removed some unused code.
-
[bug 68] Fix process() method of PaddedBlockCipher.
-
[bug 75] Remove a registry dependency in the Scrypt algorithm.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add pointycastlepubspec.yaml
name: pointycastle
version: 1.0.0-rc1
author: The Pointy Castle team
description: A Dart library implementing cryptographic algorithms
homepage: https://github.com/PointyCastle/pointycastle
environment:
sdk: ">=0.8.10+6 <3.0.0"
#documentation: http://pointycastle.github.io/docs/
dependencies:
reflectable: ">=1.0.1 <3.0.0"
dev_dependencies:
benchmark_harness: ">=1.0.4 <2.0.0"
browser: ">=0.10.0 <0.11.0"
matcher: ">=0.12.0 <0.13.0"
test: ">=0.12.7 <0.13.0"
transformers:
- reflectable:
entry_points:
- test/all_tests_web.dart
- test/pub_serve:
$include:
- test/all_tests_web{.*,}.dart
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.10.0-dev | 2016-01-26T15:47:08.882Z | Download | 1b2b97198aeed2251b671d495798b7fb64bf4205fe4e34ce2b9445b553ad04dc |
| 0.10.0 | 2016-02-03T23:34:47.717Z | Download | 4cb6b300ba8e3531d1578977feebe343b249f0de7e078ea4c37c46cd6d8e095a |
| 0.10.0+1 | 2016-02-12T14:22:16.128Z | Download | b43cba511aabb7c4061c3fc32e76e453ef93b823cf1245a16a36fa6a92d0e1bf |
| 0.10.0+2 | 2016-12-07T23:15:11.612Z | Download | 9735b0d79142d653f6a23063d450a7b00ee78688853e0f8336b8608068458e30 |
| 0.10.0+3 | 2016-12-08T03:11:52.527Z | Download | a73600c8146bee453cbb97a403fd07271c150d4734b5d5a2f46812d840be7df1 |
| 0.10.0+4 | 2016-12-08T03:38:10.100Z | Download | 694d84dcabee80272e194fca256ff9c0f369f00a472c228711471dffe18e8316 |
| 0.10.0+5 | 2016-12-08T14:37:25.638Z | Download | 517b1d0964789842b1cd0fba4036d53fe394517b5f8207fd53293cba653e0288 |
| 0.11.0 | 2018-01-28T16:53:46.490291Z | Download | b0cf5404db85ca5dfe6c07d30d64bebf2868fc6722e999af755a2e95e9a016ba |
| 0.11.1 | 2018-01-28T17:36:36.534841Z | Download | fb90ac5dba503b1c211f361fc299d8066747fcd740b8410c9425a1dc2fd72945 |
| 1.0.0-rc1 | 2018-05-28T16:28:03.989127Z | Download | 6171dd1511be99d91e00951a79c512ed5ce4da19d9255f2e6c08dba3011daad7 |
| 1.0.0-rc2 | 2018-06-21T09:43:47.185855Z | Download | e7d2ce935341921c504f5d868e476617cda97b076c5c713aee38f110ea84f7ec |
| 1.0.0-rc3 | 2018-09-14T20:09:41.086681Z | Download | c7f2351a141fd0045977ebc4ea234ac527a2edbcda7f9fe2d6bca2bf7060fc8e |
| 1.0.0-rc4 | 2018-10-04T15:36:41.436233Z | Download | 96f41a629286d3a9e6cd715f0a9afa48659f7a47666a62b76a16292d25b584e7 |
| 1.0.0 | 2018-12-17T15:42:10.534222Z | Download | f30c2cfd43a2c5f49031caeeb6fd3724626ba01fc53e14845c24d0493263488e |
| 1.0.1 | 2019-02-20T16:14:41.639259Z | Download | 3c8bca6b347c1276b515d3df0b89cefb097f6d98bb74858f57aab5ee9305c538 |
| 1.0.2 | 2019-11-15T16:38:46.136833Z | Download | 4ed9ae487542d265a99f96bb160f76b5cee725376caa6b365aa0df060d64b2db |
| 2.0.0-rc1 | 2020-09-12T05:16:21.495202Z | Download | 7871a8791a004e46fb72ca2dff54d462afc9097fe4e656ba299dec3cc98f758d |
| 2.0.0-rc2 | 2020-09-25T07:44:36.309749Z | Download | 052009b51281946bc59971bf3e887be791e2a128e181908de569892767ed9488 |
| 2.0.0 | 2020-10-02T04:18:17.009196Z | Download | ab5b4252c713b546d462b638ccdb2c94181229c7474a74edde8292ba10b850ba |
| 2.0.1 | 2021-01-16T05:15:08.063360Z | Download | 8c8d9941ab022153b2abdc40ae882dd3e6e8b482688b9581612d56c5d59fa787 |
| 3.0.0-nullsafety.2 | 2021-02-05T00:27:05.663280Z | Download | 666796a2673d20ad06c6b6641994bd54f94d12857c0b93a64e1a42252c2f7e4a |
| 3.0.1 | 2021-03-24T03:51:36.476467Z | Download | a74ed4039c152dd319514f142768d93ad3973860b240d90160cec727c8155f65 |
| 3.1.1 | 2021-06-04T00:35:49.869661Z | Download | 48883722393e27548a4ebbd9cef569622485799da1ab144ab2fe5d7e4242843d |
| 3.1.2 | 2021-06-17T22:50:45.737361Z | Download | fa7c2f46543a04be3181ab8133de00c676a8c8f75e78d2668816b65405dd053b |
| 3.1.3 | 2021-06-29T00:51:41.878311Z | Download | 416d025f33ef8d69313e0a14d725de4c9bff016551d3d14d244784ac33659304 |
| 3.2.0-rc0 | 2021-07-05T08:27:57.999331Z | Download | ed0cc2e91e0996a6582e87e73fb13cf8e858346d725049740afe8ca9125ebbf4 |
| 3.2.0 | 2021-07-29T03:42:19.386424Z | Download | add6af10b663c4460e03dac2ac3a966c062723847967702f4403098608eedbfb |
| 3.3.0 | 2021-08-12T09:43:35.064804Z | Download | 521144963c6488c74ef7b3ce3c28cbcf29db67d5da791a10e89caeca69a380e7 |
| 3.3.1 | 2021-08-18T06:22:46.887605Z | Download | be45a0ba99757eb82a18ab2a92fe756e37e06e5318360d0c57b2941ac83ed8cb |
| 3.3.2 | 2021-08-27T03:55:13.977419Z | Download | ada035ad3c8fdbdb125127ab87c47d5034a9ae700dccdbf1b60b32af52322e4f |
| 3.3.3 | 2021-09-03T07:34:51.828926Z | Download | 99374bc84c43b3d065d88a845591a8e3a4ead5613b56fdb53f01e602b7ecc1df |
| 3.3.4 | 2021-09-07T03:53:26.088801Z | Download | 60da06ea36aa0c411a71b80a80eaef3435394f50b10258673c0e3affaac6e5b4 |
| 3.3.5 | 2021-10-27T08:23:33.420974Z | Download | da190ccbf664766046c51cbae3abca61aeef369e4d80d2706989ae434b2e90f7 |
| 3.4.0-rc1 | 2021-11-03T10:13:16.121400Z | Download | bf7616a3ae4e7efc92c9cfeac170defdfceffa7e2ca342b010a92abb713dc05a |
| 3.4.0-rc2 | 2021-11-04T07:33:44.535502Z | Download | cb3307bc6532f11a433569b8658acec2ea9bc826b7f8ccbc171ec4373b41f553 |
| 3.4.0 | 2021-11-09T23:30:15.505651Z | Download | d0d95ef66e5327394d2dab33cbcb2cde3a9fb275abe75ebfedd0f54392878df7 |
| 3.5.0 | 2021-12-30T09:51:41.732206Z | Download | 21cc8c830d228dd84c84a9139394702d766622bacd3ea7a2bdcb1f00b280e9a4 |
| 3.5.1 | 2022-02-08T10:19:48.695746Z | Download | e95353c00588645b7e9dd048e705a94186ef90ed2e2f6d96e1f8319abca02df2 |
| 3.5.2 | 2022-03-07T06:26:59.810689Z | Download | d3031d8b58b62352176b13a734905ebc53d25498c7a5e161e7f3da581f2eb03f |
| 3.6.0 | 2022-04-27T06:39:00.710249Z | Download | 0edfe20fdabaf4cd97e234f66a509f8dc7dc9c55ee2c226027be7be86de612c3 |
| 3.6.1 | 2022-07-19T06:37:40.752036Z | Download | 041b249f5c70e8983ebbaff4fdea252c2af8d4912ba64b649edb17615349afef |
| 3.6.2 | 2022-09-09T03:35:11.361114Z | Download | db7306cf0249f838d1a24af52b5a5887c5bf7f31d8bb4e827d071dc0939ad346 |
| 3.7.0 | 2023-03-16T20:35:02.229325Z | Download | 57b6b78df14175658f09c5dfcfc51a46ad9561a3504fe679913dab404d0cc0f2 |
| 3.7.1 | 2023-03-21T19:43:23.159471Z | Download | ae73e842cdd27a3467a71d70cefd9b198538aab4fc7dde1d0e8c78c96225abf0 |
| 3.7.2 | 2023-03-23T18:38:12.847491Z | Download | c3120a968135aead39699267f4c74bc9a08e4e909e86bc1b0af5bfd78691123c |
| 3.7.3 | 2023-04-14T16:02:59.714861Z | Download | 7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c |
| 3.7.4 | 2024-01-15T20:53:27.969113Z | Download | 43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29 |
| 3.8.0 | 2024-04-05T11:22:16.105522Z | Download | 70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333 |
| 3.9.0 | 2024-04-19T10:19:15.148969Z | Download | 79fbafed02cfdbe85ef3fd06c7f4bc2cbcba0177e61b765264853d4253b21744 |
| 3.9.1 | 2024-05-07T18:22:31.393199Z | Download | 4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe |
| 4.0.0 | 2025-02-19T10:56:42.595398Z | Download | 92aa3841d083cc4b0f4709b5c74fd6409a3e6ba833ffc7dc6a8fee096366acf5 |
Dependencies
reflectable "\u003e=1.0.1 \u003c3.0.0"