bitwiseshiftleft / sjcl

Stanford Javascript Crypto Library
http://bitwiseshiftleft.github.com/sjcl/
Other
7.18k stars 987 forks source link

URIError on decrypt #339

Closed jezbo7 closed 7 years ago

jezbo7 commented 7 years ago

We have encrypted a JSON structure and persisted it in local storage. On decrypting the local storage value we are occasionally hitting an error on certain devices.

URIError: URI malformed at decodeURIComponent() at Object.fromBits (file:///android_asset/www/js/vendor.ca1bacdb.js:14056:171) at Object.ia (file:///android_asset/www/js/vendor.ca1bacdb.js:14101:236) at Object.decrypt (file:///android_asset/www/js/vendor.ca1bacdb.js:14101:300) at ...

Example encrypted value retrieved from local storage: "{"iv":"KBG3WF4WJeJGsOherjDT4w==","v":1,"iter":10000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"XmW0zV5zUSY=","ct":"Ez4uRcnY9mW1LfSgiS5bY945S9BnetQEIc7BqOi518p3nRk3I9wWLWF3+CGqNfB+OLUspYiYjxYDvXz0j+9FX0y14Vebeb70TIUTlrJCnmz07nB3AQURsdLO4hJoeuW0xderZ/G+1HDCmHNXWkUpxgNIoI3bdbR44ZcPzTygHQVuqyCYkAeXl9TNWIa4hdCcwnEW7EubGqb6/MpiaFYYxZhFYNu36flUj46D5ONhd96dbGR5"}"

jezbo7 commented 7 years ago

If this needs the 1.0.7 fix (the issue is noticed on Android devices) could you make 1.0.7 available on bower please?

Nilos commented 7 years ago

This is exactly the error 1.0.7 fixes. I have updated sjcl on bower to 1.0.7.