npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

sign for text with RSA key doesn't work

What I Wanted to Do

I want to create a signature for a plain text, with a private key, which is a RSA key

Everything works fine, unless, that the operation .sign(options)… doesn’t end at all. Even after 1 hour it wasn’t finished. I’ve been trying different options and modifications of the code, during the whole day, but it still doesn’t work.

What Happened Instead

It keeps on calculating without coming to a conclusion. It doesn’t crash, it doesn’t show an error and it also doesn’t abort the code. It just keeps on calculating on and on.

Reproduction Steps

Just use the code, entered for signing a message as a plain text, and not as a stream or binary or something else. Use a RSA key.


I’ve tried it out on other online pgp-signature creators with the privatekey and passphrase and everything works fine there. So there’s nothing wrong with the private key or the passphrase or the message, that I want to sign.

There’s no error showing, therefore it’s obsolete in this case.

Platform Info

$ npm --versions
<!-- paste output here -->
{ npm: '6.5.0',
  ares: '1.13.0',
  cldr: '32.0.1',
  http_parser: '2.7.0',
  icu: '60.2',
  modules: '59',
  napi: '2',
  nghttp2: '1.29.0',
  node: '9.8.0',
  openssl: '1.0.2n',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.2',
  v8: '6.2.414.46-node.21',
  zlib: '1.2.11' }

$ node -p process.platform
<!-- paste output here -->

I do not understand the reproduce steps, just use what code?

I’m using React and yarn on ubuntu, to create a signature for a simple text. The private key is a RSA with 4096 Numbits. But I’ve tried also with 2048 and with curve: p521 and still the same issue. I’ve followed the instructions in the documentation and it just doesn’t end up with calculations at the following line:
openpgp.sign(options).then(function(signed) {
cleartext =;
I’ve also tried different settings for the options and also the following line of code:
openpgp.sign(options).then(function(signed) {
detachedSig = signed.signature;
But it still has the same issue, that it doesn’t end up with the calculations. There must be some issue with the function sign(options)

The verfication causes the same issue.

openpgp.verify(options).then(function(verified) {
validity = verified.signatures[0].valid; // true
if (validity) {
    console.log('signed by key id ' + verified.signatures[0].keyid.toHex());


I had set the path for the worker, thus it didn’t work. Now I’ve just deleted the line and it works now properly.

Glad you got it going!

(This forum is about use of npm itself, rather than coding with npm packages, so you you were not likely to get a lot of replies here.)