Comments (9)
That's interesting. Let me try getting a hold of this device to repro.
Till then, can you try running the integration tests on the note ||.
The steps should be simple:
- Clone the repo
- Run ./instrumentTest/crypto/run
This will help determine whether there is some bug on these phones
from conceal.
The integration tests runs ok. But my scenario may not be included in your test cases as I made a quick review of the tests. In my app, I encrypted the data once, and hold it in memory(no change to the encrypted data later). Then I decrypt the data multiple times. On NoteII, if there are continuous decryptions to the same data in a quick rate, normally after several successful decryptions, the later ones will fail with exception. If there is one failure, then all the later decryptions will fail as well. If at that time encryption is made, then I can notice that the encrypted data changes also. (I use a fake keychain which simply returns the bytes of a const string.)
from conceal.
I haven't been able to get a hold of a note 2 yet. I should be able to get it today. Thank you for the really useful info.
There is a test called SimpleDecryptTest which encrypts once in setUp
if you add test to this:
public void testDecryptValidDataMultipleTimes() throws Exception {
for (int i = 0; i < 10000; ++i){
byte[] plainText = mCrypto.decrypt(mCipheredData, new Entity(CryptoTestUtils.ENTITY_NAME));
assertTrue(CryptoTestUtils.DECRYPTED_DATA_IS_DIFFERENT, Arrays.equals(mData, plainText));
}
}
It should be able to test the multiple quick decryption case. Are you able to repro this after adding this test.
If not it would be really awesome to have a test that is similar to the situation that you are using in your app.
from conceal.
I tried the new test. And I have also copied the logic of the test case into a simple app for test. The very interesting is that, in instrumentation test everything is ok; but in my test app it still fails. I have also tried to copy the .jar and so files from my local Conceal project to my test app project, but our of luck still.
My test app just have two buttons, before everything press button "encrypt" will encrypt the data:
mCipheredBytes = mCrypto.encrypt(mOrgBytes, mEntity);
And then pressing button "decrypt" will decrypt the data and check result:
byte[] bs = mCrypto.decrypt(mCipheredBytes, mEntity);
if(Arrays.equals(bs, mOrgBytes)){ .... }
from conceal.
I found the main difference of the test case and my test app is the implementation of keychain class.
In my KeyChain implementation, for methods of getCipherKey(), getMacKey() and getNewIV(), I return the same bytes of a string, like: "some string".getBytes().
Is this anything wrong?
from conceal.
Seems I have found the reason. Seems that for the native GCM cipher, the cipherKey and macKey must be 16 bytes long, and IV key must be 12 bytes long. There should be some javadoc about this requirement on the KeyChain interface, or there should be an exception thrown out if wrong length is returned.
from conceal.
That's awesome. Thanks for the feedback. I'll add an assert and a doc so that other people do not have to have the same problem.
from conceal.
from conceal.
Thanks a lot!
from conceal.
Related Issues (20)
- Why not think about using the cpu feature like ANDROID_CPU_ARM64_FEATURE_AES?
- Native Crash!!! HOT 6
- [Question] Password based key derivation usage HOT 5
- native crash and app can't pickup the exception,Can this exception wrap with java exception,then i can catch it
- native crash on Samsung HOT 1
- README.md refers to deprecated crypto.getCipherOutputStream
- What do I need to know in order to encrypt elsewhere for Conceal to decrypt? HOT 3
- The speed of decrypting the file is twice faster than the speed of encrypting the same file
- How to save encrypted file to internal folder ?
- App crashed in native method
- Conflicts using in React Native project due to com.facebook.jni.DestructorThread HOT 3
- showing NoSuchMethodException on Android P when initialing the SoLoader HOT 10
- Incompatibility with the Facebook library Flipper
- Conflict with React Native in v2.0.2 HOT 6
- Subpar PBKDF2 performance
- PHP Implementation HOT 1
- signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) Native Crash in Google Play Console HOT 5
- App crashes when running as 64 bit version: `libfb.so is 64-bit instead of 32-bit` HOT 1
- Fatal signal 11 (SIGSEGV), code 2 upon file decryption.
- Native crash (conceal version 2.0.2) java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfb.so 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 conceal.