asn1lib 0.5.8

  • Readme
  • Changelog
  • Installing
  • 80

ASN.1 Parser for Dart. #

Encodes & decodes ASN1 using BER encoding.

There is just enough implementation here to get an LDAP client library working. Contributions welcome.

Samples #

Encoding #

import 'package:asn1lib/asn1lib.dart';

var s = ASN1Sequence();
s.add(ASN1Integer(23));
s.add(ASN1OctetString('This is a test'));
s.add(ASN1Boolean(true));

// GET the BER Stream
var bytes = s.encodedBytes;

Decoding #

import 'package:asn1lib/asn1lib.dart';

// e.g. bytes from the Encoding Example
var p = ASN1Parser(bytes);
var s2 = p.nextObject();
// s2 is a sequence...

Changelog #

0.5.8 #

Merged #30

  • Add IA5String
  • Add associated tests
  • Make sure parser handles IA5 and UT8 String
  • Add large test case with PEM Certificate that includes IA5 and UTF8 Strings
  • Cleanup README

0.5.7 #

Merged #29

  • Expand AS1NNull to accept tag
  • Associated test cases
  • Added David Janes as author

0.5.6 #

Merged #28

Add ASN1UTF8String

0.5.5 #

Merged #27

Updates to ASN1ObjectIdentifier to:

  • allow creation from dotted number lists
  • allow creation from dotted number strings
  • allow names to be registered, for shorthands
  • allow bulk name registration
  • commonly used names (obviously, what this is could be expanded)

0.5.4 #

Fixed #26

0.5.1 #

Add AS1Integer.fromInt factory method

0.5.0 #

  • Convert use of BigInteger to dart SDK BigInt

0.4.3 #

  • Updates for dart 2

0.4.2 #

  • Added contentBytes() getter
  • Removed Int64List dependency and use bignum's BigInteger instead

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  asn1lib: ^0.5.8

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:asn1lib/asn1lib.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
89
Health:
Code health derived from static analysis. [more]
56
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
80
Learn more about scoring.

We analyzed this package on Nov 23, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:asn1lib/asn1lib.dart.

Health suggestions

Fix lib/asn1parser.dart. (-11.33 points)

Analysis of lib/asn1parser.dart reported 24 hints, including:

line 18 col 3: Prefer using /// for doc comments.

line 33 col 20: Unnecessary new keyword.

line 36 col 16: Don't explicitly initialize variables to null.

line 39 col 7: DO use curly braces for all flow control structures.

line 44 col 9: DO use curly braces for all flow control structures.

Fix lib/asn1integer.dart. (-7.24 points)

Analysis of lib/asn1integer.dart reported 15 hints, including:

line 2 col 1: Prefer using /// for doc comments.

line 13 col 35: Use = to separate a named parameter from its default value.

line 15 col 33: Use = to separate a named parameter from its default value.

line 38 col 53: Unnecessary new keyword.

line 44 col 24: Unnecessary new keyword.

Fix lib/asn1object.dart. (-7.24 points)

Analysis of lib/asn1object.dart reported 15 hints, including:

line 4 col 1: Prefer using /// for doc comments.

line 18 col 3: Prefer using /// for doc comments.

line 38 col 7: DO use curly braces for all flow control structures.

line 47 col 22: Use = to separate a named parameter from its default value.

line 49 col 3: Prefer using /// for doc comments.

Fix additional 17 files with analysis or formatting issues. (-29.62 points)

Additional issues in the following files:

  • lib/asn1length.dart (10 hints)
  • lib/asn1octetstring.dart (9 hints)
  • lib/asn1set.dart (8 hints)
  • lib/asn1sequence.dart (7 hints)
  • lib/asn1bitstring.dart (4 hints)
  • lib/asn1objectidentifier.dart (4 hints)
  • lib/asn1utctime.dart (4 hints)
  • lib/asn1util.dart (4 hints)
  • lib/asn1boolean.dart (3 hints)
  • lib/asn1enumerated.dart (3 hints)
  • lib/asn1ia5string.dart (1 hint)
  • lib/asn1null.dart (1 hint)
  • lib/asn1printablestring.dart (1 hint)
  • lib/asn1utf8string.dart (1 hint)
  • lib/asn1constants.dart (Run dartfmt to format lib/asn1constants.dart.)
  • lib/asn1exception.dart (Run dartfmt to format lib/asn1exception.dart.)
  • lib/asn1lib.dart (Run dartfmt to format lib/asn1lib.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and asn1lib.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.69.0 <3.0.0
Dev dependencies
convert ^2.0.1
test >=1.5.3