crypto-browserify icon indicating copy to clipboard operation
crypto-browserify copied to clipboard

crypto.constants = undefined

Open futurelucas4502 opened this issue 5 years ago • 1 comments

When using crypto-browserify or just browserify to require crypto i want to use the following:

const encryptedData = crypto.publicEncrypt({
        key: `some public key`,
        padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
        oaepHash: "sha256",
    },
        Buffer.from(password) // We convert the data string to a buffer using `Buffer.from` so we can manipulate the data using publicEncrypt
    )

But crypto.constants = undefined so I'm not sure what to do?

This issue has also been mentioned on browserify here and was requested to be moved to this repo as well.

futurelucas4502 avatar Aug 07 '20 17:08 futurelucas4502

https://github.com/crypto-browserify/crypto-browserify/blob/460a13b5bf1e4ea60dc995906ba0543f7933a32b/index.js#L81

Erudition avatar Oct 23 '21 01:10 Erudition