This quick-start provides just enough information to get you started using the Java client library within Android Studio.

Downloading the Java library

You will have to download IQryptParse Android package from here.

Add a Reference to the Java client JARs

Create a folder ("libs") in your project directory, then from downloaded package, /lib folder, copy these four jars into your "libs" folder:

  • IQryptParse-0.1.jar
  • genson-1.2.jar
  • bolts-android-1.2.1.jar
  • Parse-1.10.2.jar

(you can get bolts and Parse jars from parse.com website)

Add Required import statements

As a minimum you will need the following import statements:

import com.parse.*;

import com.iqryptparse.*;

Encryption settings

With IQryptParse you can encrypt fields of a ParseObject with different encryption schemes: OPE, DET, RND.

  • OPE - order preserving encryption
  • DET - deterministic encryption
  • RND - randomized encryption

To let IQrypt to encrypt a ParseObject field, you will have to use IQryptParseConfigurator.encryptField(...) method. Example:

 IQryptParseConfigurator.encryptField("Armor", "myIntField", EncryptionType.OPE, int.class);

After you set how fields should be encrypted, you will have to set the cipher and the encryption key:

 IQryptParseConfigurator.setEncryptionChiper(Cipher.AES256, "my_super_secret");

*On production apps get the encryption key from a safe location- see Vault (do not embed it into the code).

Example using the key from Vault:

 VaultKey vKey = Vault.getKey("key1", "UsernameParse");
String realEncryptionKey = Vault.decrypt(vKey, EPassword);//we suppose EPassword is taken from UI filled by the user of app
IQryptParseConfigurator.setEncryptionChiper(Cipher.AES256, realEncryptionKey );

And then initialize Parse:

  Parse.initialize(this.getContext(),"Application_ID", "Java key");


Create and store an IQryptParseObject

IQryptParseObject is derived from ParseObject and transparently encrypt fields without any extra intervention.

Example of how you would create and store a ParseObject using Parse Android SDK:

ParseObject obj = new ParseObject("Armor");
obj.put("myIntField",30);

obj.save();

And here is an example of creating and store an IQryptParseObject using IQrypt SDK:

IQryptParseObject obj = new IQryptParseObject("Armor");
obj.put("myIntField",30);

obj.save();

Find an Existing IQryptParseObject

In this example we will read back an IQryptParseObject assuming we know the Id value.

Here is an example how you would do with Parse Android SDK

   ParseQuery<ParseObject> query = new ParseQuery<ParseObject >("Armor");
   ParseObject objFromServer = query.get(obj.getObjectId());
   int myIntValue = (int)objFromServer.get("myIntField");

And here is an example using IQryptParse SDK

   IQryptParseQuery<IQryptParseObject> query = new IQryptParseQuery<IQryptParseObject >("Armor");
   IQryptParseObject objFromServer = query.get(obj.getObjectId());
   int myIntValue = (int)objFromServer.get("myIntField");

Update an Existing IQryptParseObject

To update an existing ParseObject using Parse Android SDK you would do:


ParseQuery<ParseObject> query = new ParseQuery<ParseObject >("Armor");
ParseObject objFromServer = query.get(obj.getObjectId());
objFromServer.put("myIntField",40);
objFromServer.save();

To update an existing IQryptParseObject you will have to do:


IQryptParseQuery<IQryptParseObject> query = new IQryptParseQuery<IQryptParseObject >("Armor");
IQryptParseObject objFromServer = query.get(obj.getObjectId());
objFromServer.put("myIntField",40);
objFromServer.save();

Delete an Existing IQryptParseObject

To delete an existing ParseObject using Parse Android SDK you would do:

ParseQuery<ParseObject> query = new ParseQuery<ParseObject >("Armor");
ParseObject objFromServer =  query.get(obj.getObjectId());
objFromServer.delete();

To delete an existing IQryptParseObject you will have to do:


IQryptParseQuery<IQryptParseObject> query = new IQryptParseQuery<IQryptParseObject >("Armor");
IQryptParseObject objFromServer =  query.get(obj.getObjectId());
objFromServer.delete();