Comments (17)
Hey @bestlbw
Can you please give us some more information?
What code are you running?
Android/iOS?
from react-native-rsa-native.
@amitaymolko ios ,i need to encrypt json string that greater than 117,will return ‘undefined’,so i
try to change the code realize the block cyphers ,would u give me a example ? thanks!
from react-native-rsa-native.
can you send the code you are running?
from react-native-rsa-native.
the json String like this :
{"systemId":"000001","reserve1":"","reserve2":"","transflag":1,"message":{"head"{"answerCode":"000000","trxnDate":1505905415917,"trxnFlag":1,"trxnSeq":0,"trxnCode":1003},"requestBody":{"securityUserId":"bjzxmr","pageStart":1,"numberOfPages":20,"custometype":"I","searchCondition":"I","searchValue":"111","searchType":"01"}}}
from react-native-rsa-native.
can you please send the full code that you are running so i can properly recreate the issue on my end?
from react-native-rsa-native.
oh no ,i think u don,t know my meaning , changing the code for solving ‘unknown block type’ error
from react-native-rsa-native.
In order for me to recreate your issue I need a copy of the code you are running to get the ‘unknown block type’ error.
I need this to understand the issue better and things like:
What functions are you calling in the library? In what order?
from react-native-rsa-native.
ok ,i know your meaning,
const params={"systemId":"000001","reserve1":"","reserve2":"","transflag":1,"requestBody":{"securityUserId":"bjzxmr","pageStart":1,"numberOfPages":20,"custometype":"I","searchCondition":"I","searchValue":"111","searchType":"01"}}} RSA.encrypt(params, pubKey)
from react-native-rsa-native.
RSA.encrypt
takes a string param to encrypt.
try something like:
RSA.encrypt(JSON.stringify(params), pubKey)
from react-native-rsa-native.
i know , i just omitted, until return ‘undifined’
from react-native-rsa-native.
So please send me full code you are running, without omitting anything.
You are making it very difficult to evaluate this issue...
from react-native-rsa-native.
cry。。。
const params={"systemId":"000001","reserve1":"","reserve2":"","transflag":1,"requestBody":{"securityUserId":"bjzxmr","pageStart":1,"numberOfPages":20,"custometype":"I","searchCondition":"I","searchValue":"111","searchType":"01"}}} RSA.encrypt(JSON.stringify(params), pubKey)
return ‘undifined’
from react-native-rsa-native.
ok I rewrote the encrypt decrypt for iOS to handle bigger blocks of data.
Please test with latest version 1.0.10
from react-native-rsa-native.
@amitaymolko thank you very much to solve my problem,i try to change the code but no effect,thanks
from react-native-rsa-native.
Maybe the problem is that you cannnot encrypt blocks larger then your key with RSA. I'm guessing you're using a 1024-bit RSA key and trying to encrypt data > 128 bytes. Instead, use AES to encrypt the block and use RSA to encrypt the random AES key. This is a limitation of RSA, not of this library. When I try 2048 bit RSA and a 256 byte block, it works fine on IOS.
running this on your PEM: openssl rsa -in test.pem -text -noout | grep bit
https://www.npmjs.com/package/react-native-aes
from react-native-rsa-native.
Worse: it looks like the code on ios is broken if the data has a null byte in it (which it can!).
from react-native-rsa-native.
Do this for large data:
aeskey = random(32)
iv = random(16)
encdata = encryptaescbc(data, aeskey, iv)
enckey = encryptrsa(aeskey, publickey)
result = iv+enckey+encdata
from react-native-rsa-native.
Related Issues (20)
- Incompatible Format
- Using RSA.signWithAlgorithm throws an error with some algorithms
- MIT License issue
- RSA decryption doesn't works with newest react native version 0.68 HOT 1
- fatal error: module map file ... react_native_rsa_native.modulemap not found HOT 1
- Android 8.1.0
- RSAECNative.swift line 357_ RSAECNative._encrypt(data:) HOT 2
- RSAKeychain - do key pairs get shared across devices with same iCloud account?
- On iOS RSAKeychain.getPublicKey returns an object instead of a string HOT 1
- After upgrade from v1 to v2 the keys are lost on iOS devices HOT 1
- [Unhandled promise rejection: TypeError: null is not an object (evaluating '_reactNativeRsaNative.RSA.generateKeys')] HOT 8
- Open to maintain library HOT 1
- IOS Build fails "include of non-modular header"
- Inconsistent parameter order
- Differently formatted keys on android and iOS HOT 1
- Improper key description in Readme file
- How to test code using this library?
- What algorithm is used to sign a message?
- This Lib works with Expo? HOT 2
- Could not build Objective-C module 'react_native_rsa_native' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-rsa-native.