-
Notifications
You must be signed in to change notification settings - Fork 401
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
decrypt method of legacyCryptoModule throws an error for unencrypted string values with "_" #353
Comments
Initialising PubNub instance along with cryptoModule( In the description code snippet, Message is being decrypted manually. In case of possible unencrypted message, we need to catch the error and return null. If we want to return null instead original unencrypted message Reason: cryptoModules are able to decrypted both 128 and 256 bit encrypted messages for backward compatibility. So now |
Also,
one possible solution is: or try catch-error with manual decryption if that is compatible with other app logic! |
Thank you so much for the quick response. We need to use manual decryption for now so will catch & handle the error accordingly. 👍 Also would like to request a couple of updates in the guide here in the section If you are not specifying the cipher key as part of your PubNub configuration but encrypting messages as needed:
Thanks again! |
Hello,
We've recently updated our Pubnub SDK from version 4.33.1 to the latest 7.4.5 as the first step to use 256-bit encryption for better security, though the 256-bit encryption is not yet enabled. So far we have followed the steps mentioned in the guide here.
Due to a certain behavior change in the
decrypt
method, our web application is broken. We have a listener on the React web app to receive messages - which can be encrypted or unencrypted messages. For unencrypted messages/values, earlier thepubnubInstance.decrypt()
method used to returnnull
, but the newcryptoModule.decrypt()
method throws an error whenever a value with character_
is passed to it. Returnsnull
as expected for a string value without_
.Would it be possible to fix this and achieve the old behavior of returning
null
as expected? Is there any other way to handle both encrypted & unencrypted messages on the web app listener without trying to decrypt the unencrypted messages, thus avoiding this issue?Thanks.
Working snippet with v4.33.1:
Snippet having the issue with v7.4.5:
The text was updated successfully, but these errors were encountered: