jovial_misc_pc 0.9.0 copy "jovial_misc_pc: ^0.9.0" to clipboard
jovial_misc_pc: ^0.9.0 copied to clipboard

Library split off from jovial_misc to isolate PointyCastle dependencies

example/example.dart

import 'dart:async';
import 'dart:io';
import 'package:pointycastle/pointycastle.dart';
import 'package:jovial_misc/io_utils.dart';
import 'package:jovial_misc_pc/io_utils.dart';

///
/// Example of using [DataOutputSink] and [DataInputStream] with
/// PointyCastle encription/decryption to
/// encode values that are compatible with `java.io.DataInputStream`
/// and `java.io.DataOutputStream`
///
Future<void> dataIoStreamExample(BlockCipher cipher, Padding padding) async {
  final file = File.fromUri(Directory.systemTemp.uri.resolve('test.dat'));
  final sink = EncryptingSink(cipher, file.openWrite(), padding);
  final out = DataOutputSink(sink);
  out.writeUTF8('Hello, world.');
  sink.close();

  final str = DecryptingStream(cipher, file.openRead(), padding);
  final dis = DataInputStream(str);
  print(await dis.readUTF8());
  await dis.close();
  await file.delete();
}
0
likes
150
points
59
downloads

Publisher

unverified uploader

Weekly Downloads

Library split off from jovial_misc to isolate PointyCastle dependencies

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

async, collection, convert, intl, jovial_misc, pointycastle

More

Packages that depend on jovial_misc_pc