tradle / react-native-crypto

partial implementation of node's `crypto` for react-native
MIT License
370 stars 84 forks source link

Failed to match tag: "int" at: ["modulus"] #8

Closed kevinvn1709 closed 7 years ago

kevinvn1709 commented 7 years ago

Hi, @mvayngrib There is an tricky bug with publicEncrypt function.

I deep into the source code to debug at ~/node_modules/asn1.js/lib/asn1/decoders/der.js file. I got error at line

image

And error throw out the screen like this image

But, when I comment this block code (by pass that check). My code will work as a charm. I did not know about that validate for? Could you explain for me about that?

mvayngrib commented 7 years ago

@kevinvn1709 sorry, don't know much about the internals of the various libs assembled in react-native-crypto. At the moment I'm very busy, but I'll have a look in a few days. I hope you figure it out by then!

kevinvn1709 commented 7 years ago

Thanks for your quick response. I found that this error comes from XCode 8.1. Maybe It is not suitable with latest version of XCode

I had cloned your repo RNCTest (https://github.com/mvayngrib/rnctest) and run with XCode 8.1. It produces same errors. So I spend time to downgrade to Xcode 7.3.1 then it works again.

mvayngrib commented 7 years ago

@kevinvn1709 actually i ran into something yesterday that might be related to this. Because iOS 10 has an updated JavaScriptCore, there are some bugs when using a dependency of Buffer < 4.5. So if you're using XCode 8 and testing on iOS 10, make sure that if you have buffer among the dependencies, it's >= 4.5. I updated react-native-randombytes and react-native-ecc yesterday because of this issue. Let me know if that helps!

kevinvn1709 commented 7 years ago

@mvayngrib: Its so great. I rebuild my source code with your updates. It works perfectly on Xcode 8.1 and iOS 10. Thanks for your works.

mvayngrib commented 7 years ago

@kevinvn1709 so glad to hear that! Good luck with your project

cbartondock commented 7 years ago

Having the same issue (thank you so much for doing the hard work of finding the cause kevinvn1709), but my crypto libraries are up to date. I'm hesitant to hackily disable a check in the asn1 file... will check which buffer versions I am depending on.

mvayngrib commented 7 years ago

closing for now due to inactivity