Giter Club home page Giter Club logo

pem's People

Contributors

scribetw avatar tejainece avatar

Watchers

 avatar  avatar

pem's Issues

CRLF bug

test/bug_test.dart

import 'package:ninja_pem/ninja_pem.dart';
import 'package:test/test.dart';

void main() {
  test('CRLF bug', () {
    final pemString = "-----BEGIN KEY1-----\r\n"
      "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2Np\r\n"
      "bmcgZWxpdC4uLkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0LCBjb25zZWN0ZXR1\r\n"
      "ciBhZGlwaXNjaW5nIGVsaXQuLi5Mb3JlbSBpcHN1bSBkb2xvciBzaXQgYW1ldCwg\r\n"
      "Y29uc2VjdGV0dXIgYWRpcGlzY2luZyBlbGl0Li4uTG9yZW0gaXBzdW0gZG9sb3Ig\r\n"
      "c2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4uLkxvcmVtIGlw\r\n"
      "c3VtIGRvbG9yIHNpdCBhbWV0LCBjb25zZWN0ZXR1ciBhZGlwaXNjaW5nIGVsaXQu\r\n"
      "Li4K\r\n"
      "-----END KEY1-----";

    final part = PemPart.decodeLabelled(pemString, ['KEY1']);
    expect(part.data, isNotEmpty);
  });
}

Expected: no error
Actual:

Exception: Invalid data line
  package:ninja_pem/src/ninja_pem_base.dart 147:7  _decodeNextPem
  package:ninja_pem/src/ninja_pem_base.dart 22:20  new PemPart.decodeLabelled
  test\bug_test.dart 16:26                         main.<fn>

static final _newlineRegexp = RegExp(r'\n|\r|(\r\n)');

If moving \r\n to the first position, the problem will be solved.

static final _newlineRegexp = RegExp(r'(\r\n)|\n|\r');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.