Skip to content

SignFinal error no longer returned, instead returning a PEM routines:PEM_read_bio:no start line error #408

Closed

Description

@ryanseys

In fooling around with iojs v1.0.1, I ran the unit tests for GoogleCloudPlatform/gcloud-node which were passing on latest node 0.10.x and now a single test is no longer passing.

It appears that when attempting to sign a PEM, during a failure, a SignFinal error is no longer returned. Instead the error message returned is now error:0906D06C:PEM routines:PEM_read_bio:no start line. I've monkey-patched the test here: googleapis/google-cloud-node#346 but this doesn't handle any other sort of SignFinal error.

I looked at the changelog and it gave no indication that this was a breaking change so I'm assuming it was an unintentional change.

Activity

  1. bnoordhuis commented on Jan 14, 2015

    @bnoordhuis
    Member

    If you can put together a standalone test case (i.e. a single script that uses only core modules), I or @indutny will take a look. Thanks.

  2. added
    cryptoIssues and PRs related to the crypto subsystem.
    on Jan 14, 2015
  3. ryanseys commented on Jan 14, 2015

    @ryanseys
    ContributorAuthor

    Certainly! Here's a standalone test case:

    var crypto = require('crypto');
    var pem = 'this is a bad key with no start line';
    
    var sign = crypto.createSign('RSA-SHA256');
    sign.update('abcdef');  // data
    var sig = sign.sign(pem, 'hex');

    On io.js v1.0.1 stacktrace:

    # ~ $ node crypto-test.js
    crypto.js:309
      var ret = this._handle.sign(toBuf(key), null, passphrase);
                             ^
    Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
        at Error (native)
        at Sign.sign (crypto.js:309:26)
        at Object.<anonymous> (/Users/ryanseys/crypto-test.js:6:16)
        at Module._compile (module.js:446:26)
        at Object.Module._extensions..js (module.js:464:10)
        at Module.load (module.js:341:32)
        at Function.Module._load (module.js:296:12)
        at Function.Module.runMain (module.js:487:10)
        at startup (node.js:111:16)
        at node.js:809:3

    On node 0.10.33 stacktrace:

    # ~ $ /usr/local/Cellar/node/0.10.33_1/bin/node crypto-test.js
    140735116468992:error:0906D06C:PEM routines:PEM_read_bio:no start line:../deps/openssl/openssl/crypto/pem/pem_lib.c:703:Expecting: ANY PRIVATE KEY
    
    crypto.js:429
      var ret = this._binding.sign(toBuf(key));
                              ^
    Error: SignFinal error
        at Sign.sign (crypto.js:429:27)
        at Object.<anonymous> (/Users/ryanseys/crypto-test.js:6:16)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Function.Module.runMain (module.js:497:10)
        at startup (node.js:119:16)
        at node.js:906:3
  4. bnoordhuis commented on Jan 14, 2015

    @bnoordhuis
    Member

    Thanks, I see what you're saying now. It's an intentional change actually, one that also exists in joyent/node@v0.11 (can't find the commit just now but the change was made sometime last year.)

  5. ryanseys commented on Jan 14, 2015

    @ryanseys
    ContributorAuthor

    Ah, okay. I kinda figured that's what happened. I should have checked with the latest node 0.11.x first. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions