Coder Social home page Coder Social logo

Comments (5)

marklagendijk avatar marklagendijk commented on July 28, 2024 1

I stumbled on the same problem. Full example for the solution using forge:

var signedXml = new SignedXml();
signedXml.signingKey = readPrivateKeyFromProtectedPem('myPrivateKey.pem', 'myPassword');

function readPrivateKeyFromProtectedPem(path, passphrase){
    var pem = fs.readFileSync(path).toString();
    var privateKey = pki.decryptRsaPrivateKey(pem, passphrase);
    return pki.privateKeyToPem(privateKey);
}

from xml-crypto.

tngan avatar tngan commented on July 28, 2024

Just for sharing, now I use this one digitalbazaar/forge to get the pem protected by a passphrase. They have an API pki.decryptRsaPrivateKey( file, passphrase ) to decrypt the pem.

from xml-crypto.

bjrmatos avatar bjrmatos commented on July 28, 2024

@tngan cool! i use forge in some of my apps to parse certificates.. we'll have forge in mind when find a solution, thnks

from xml-crypto.

chrisgh1 avatar chrisgh1 commented on July 28, 2024

has this changed in recent node versions? I'm getting the following error which looks like passphrase could be passed in? But I'm not familiar with how this module works.

crypto.js:283
var ret = this._handle.sign(toBuf(key), null, passphrase);

I'm on Node version 6.9.1

from xml-crypto.

cjbarth avatar cjbarth commented on July 28, 2024

@yaronn , @tngan , would you be interested in creating a PR with a test suite to add that functionality to xml-crypto?

from xml-crypto.

Related Issues (20)

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.