Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

TO DELETE #60

Open
tasbin opened this issue Aug 24, 2017 · 3 comments
Open

TO DELETE #60

tasbin opened this issue Aug 24, 2017 · 3 comments

Comments

@tasbin
Copy link

tasbin commented Aug 24, 2017

DELETED

@pranaysharma
Copy link

Hi I would like to try to fix it ? Could someone advice how to proceed? Do we just need to create a random Byte array?

@designer2k2
Copy link
Contributor

after reading this:
https://medium.com/@tiensinodev/basic-android-encryption-dos-and-don-ts-7bc2cd3335ff
https://stackoverflow.com/questions/31036780/android-cryptography-api-not-generating-safe-iv-for-aes
https://stackoverflow.com/questions/29267435/generating-random-iv-for-aes-in-java

i think maybe something like this should work:

SecureRandom r = new SecureRandom();
byte[] ivBytes = new byte[16];
r.nextBytes(ivBytes);

cipher.init(Cipher.ENCRYPT_MODE, keySpec, new IvParameterSpec(ivBytes));

but i have no idea how to replace the line51 with the above to keep it safe, so no pull request from my side

@dee12452
Copy link

Looks like SecureRandom will work but there's one possible problem with that.
According to the Java docs (https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html) SecureRandom could possibly block the thread that calls .nextBytes(...).
I haven't dived into where the constructor lies for this class but if it's on a thread such as the main UI thread then the solution might not be as simple as a one-liner

@tasbin tasbin changed the title hard-coded and insecure Initialization vector TO DELETED Jul 5, 2021
@tasbin tasbin changed the title TO DELETED TO DELETE Jul 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants