Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openpgp in 4.0 not working #16187

Closed
jano-m opened this issue Dec 24, 2018 · 11 comments
Closed

openpgp in 4.0 not working #16187

jano-m opened this issue Dec 24, 2018 · 11 comments

Comments

@jano-m
Copy link

jano-m commented Dec 24, 2018

  • Output of node_modules/.bin/electron --version: v4.0.0
  • Operating System (Platform and Version): win
  • Output of node_modules/.bin/electron --version on last known working Electron version (if applicable): 3.1.0-beta.4

Expected Behavior
const openpgp = require('openpgp')
async function readKey() {
let armored = await openpgp.key.readArmored(pubkey);
console.log(armored);
publicKeys = armored.keys;
}
readKey();
should print '{keys: [Object]}'

Actual behavior
It will print

{ keys: [],
  err:
   [ TypeError: (var).countUse is not a function
         at Object.transformPair (C:\Users\Jan\Documents\editor\node_modules\openpgp\dist\openpgp.js:23051:20)
         at Promise (C:\Users\Jan\Documents\editor\node_modules\openpgp\dist\openpgp.js:29722:65)
         at new Promise (<anonymous>)
         at Object.dearmor [as decode] (C:\Users\Jan\Documents\editor\node_modules\openpgp\dist\openpgp.js:29710:10)
         at Object.readArmored (C:\Users\Jan\Documents\editor\node_modules\openpgp\dist\openpgp.js:32247:41)
         at readKey (C:\Users\Jan\Documents\editor\config\pgp.js:53:35)
         at Object.<anonymous> (C:\Users\Jan\Documents\editor\config\pgp.js:57:1)
         at Object.<anonymous> (C:\Users\Jan\Documents\editor\config\pgp.js:75:3)
         at Module._compile (internal/modules/cjs/loader.js:693:30)
         at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10) ] } 

instead. Note that countUse does not occur anywhere in openpgp package. It must come from Electron 4.0

@welcome
Copy link

welcome bot commented Dec 24, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@shiftkey
Copy link
Contributor

@jano-m it's not clear to me which version of openpgp is used which triggers this issue. Can you include that?

@jano-m
Copy link
Author

jano-m commented Dec 24, 2018

The latest version of openpgp: 4.3.0

@nornagon
Copy link
Member

nornagon commented Jan 2, 2019

I suspect this is the same root cause as #16195 (i.e., that we switched from OpenSSL to BoringSSL). That's a somewhat weird error though. Can you include an example of a pubkey that causes the issue? the code as pasted isn't a complete repro.

@jano-m
Copy link
Author

jano-m commented Jan 3, 2019

electron-quick-start.zip
I have created a clone of electron-quick-start, generated a new public key with gpg and added the problematic code at the beginning of main.js. Still the same problem. Attaching as a zip file.

@twiss
Copy link

twiss commented Jan 5, 2019

@nornagon
Copy link
Member

new TransformStream() in Electron 4.0.1 does not trigger any error on my machine.

@datenstau
Copy link

datenstau commented Jan 26, 2019

I've got this error in 4.0.1:
Error: Error encrypting message: Unknown cipher at Cipheriv.createCipherBase (internal/crypto/cipher.js:79:18) at Cipheriv.createCipherWithIV (internal/crypto/cipher.js:119:20) at new Cipheriv (internal/crypto/cipher.js:225:22) at new createCipheriv (crypto.js:105:10) at nodeEncrypt ([...]/node_modules/openpgp/dist/openpgp.js:24159:21) at aesEncrypt ([...]/node_modules/openpgp/dist/openpgp.js:24121:12) at Object.encrypt ([...]/node_modules/openpgp/dist/openpgp.js:24056:14) at SymEncryptedSessionKey.encrypt ([...]/node_modules/openpgp/dist/openpgp.js:38643:49)

Definitively a bug with BoringSSL. Node.js v8.12.0 and electron v3.0.4 work as expected.

@nornagon
Copy link
Member

@datenstau can you tell what cipher it's trying to create? boringssl doesn't support every cipher that openssl does, but it does have the major ones. However, it doesn't support every alias for a cipher that openssl supports. It's quite possible that boringssl already supports the cipher you're trying to use, just under a different name.

@datenstau
Copy link

@nornagon openpgp is trying to use aes-256-cfb in this case.

@nornagon
Copy link
Member

great, in that case it should be resolved by #16573.

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

No branches or pull requests

6 participants