Tag Archives: dev

react-native crypto-js aes decrypt problem and solution

Photo by Hédi Benyounes on Unsplash

CryptoJS is a popular encrypt/decrypt library used by JS community. However, the latest version 4.x.x just can’t be used on react-native. It will need native crypto library as base. Since react-native doesn’t have the native crypto library supported by now, it’s not so easy to get it working on react native platform.

For my project on-going, I need the AES encrypt/decrypt part to work on react native. It will be very useful if CryptoJS could work on it.

While searching the solution to this problem, react-native-crypto-js library has jumped into my sight. From the github repo shown, this library just packaged the crypto-js v3.1.2 from source and register it into npm registry. After some testing, I found it can’t decrypt my encrypted source correctly. The final decrypted result will always stop at some ending point before the real end. Around 10-20 bytes are cut out after decryption.

Then I try to go back to crypto-js github to see the version tag. Fortunately, there still exists version 3.1.x and be registered in npm. For now it’s version 3.1.8. Version 4.x have breaking changes and version 3.x still keep the original source level dependency for encryption/decryption.

As a result, I then tried to install version 3.1.8 to react-native project. And it really worked. The original crypto-js code can work perfectly on react-native project. No more native crypto library dependency required.

If you have the same problems on react-native crypto-js support, try to install version 3.1.x to your project. Simple encryption/decryption will be ready to work.

Happy Coding!

Site has been upgraded to https

Following the trend of internet world, the site “en.tomosware.com” has improved its security level to SSL with https as default protocol supported.

This move consumes a little bit efforts on settings of backend http server and certificates maintenance. Thanks to LetsEncrypt for supporting so many facilities to enable this security improvement of the site. Truly, if there were no LetsEncrypt, there will be no security enhancement to the site since it will cost a lot to have a signed certificate.

Now the whole site has been secured. All contents are involved in. You will see the Green lock in Firefox or a comfortable lock symbol with Chrome or other browser. If not, please tell me to correct that error.

As a result, we are all in a safer world now. 🙂