You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
I use 'crypto.publicEncrypt' in my code RN. Android test, release and Ios test word good, but IOS release error 'Error secure random number generation not supported by this browser use chrome, FireFox or Internet Explorer 1'
Hi.
I use 'crypto.publicEncrypt' in my code RN. Android test, release and Ios test word good, but IOS release error 'Error secure random number generation not supported by this browser use chrome, FireFox or Internet Explorer 1'
System:
React-native-cli: 2.0.1
React-native: 0.61.5
Node: v12.11.1
My code:
RNRandomBytes.randomBytes(24, (err, bytes) => {
const randomAESkey = bytes
const sha256Pass = CryptoJS.HmacSHA256(password, Config.SHARE_KEY)
const key = CryptoJS.enc.Base64.parse(randomAESkey)
let iv = new Buffer(randomAESkey, 'base64').slice(0, 16).toString('base64')
iv = CryptoJS.enc.Base64.parse(iv)
const aes256Pass = CryptoJS.AES.encrypt(sha256Pass, key, { iv: iv, mode: CryptoJS.mode.CBC, })
const deviceId = DeviceInfo.getUniqueId()
const RSA_PKCS1_PADDING = 1
console.log('Buffer.from(randomAESkey) ', Buffer.from(randomAESkey))
const enc = crypto.publicEncrypt( --> Begin error
{
key: Config.APP_PUBLIC_KEY,
padding: RSA_PKCS1_PADDING,
},
Buffer.from(randomAESkey),
)
const data = {
Password: aes256Pass.toString(),
UserName: (registerOrLoginState && registerOrLoginState.Phone) || '',
IsProvideKey: true,
Imei: deviceId,
EncryptKey: enc.toString('base64'),
SessionId: '',
DeviceType: Platform.OS.toUpperCase(),
}
}
The text was updated successfully, but these errors were encountered: