isomorphic-webcrypto icon indicating copy to clipboard operation
isomorphic-webcrypto copied to clipboard

Non-functional RSA-OEAP Support

Open cryptoAlgorithm opened this issue 4 years ago • 0 comments

In my React Native project, I decrypt data sent from another React frontend. The 2 most heavily used algorithms are RSA-OEAP and AES-GCM. Unfortunately, I found that the RSA-OEAP support was pretty broken, and using this

crypto.subtle.encrypt(
    {
        name: "RSA-OAEP",
        //label: Uint8Array([...]) //optional
    },
    publicKey, //from generateKey or importKey above
    data //ArrayBuffer of data you want to encrypt
)
.then(function(encrypted){
    //returns an ArrayBuffer containing the encrypted data
    console.log(new Uint8Array(encrypted));
})
.catch(function(err){
    console.error(err);
});

snippet from the WebCrypto examples repo in the readme caused an error:

Possible Unhandled Promise Rejection (id: 0):
TypeError: undefined is not an object (evaluating 'algorithm.hash.name.toUpperCase')

After adding the hash name (SHA-512), it didn't return any error but returned an empty ArrayBuffer []

I hope that this issue can be fixed soon (maybe by merging the latest mscrypto library?) so that i can use this library in my project.

cryptoAlgorithm avatar Jul 04 '21 05:07 cryptoAlgorithm