IQryptPFObject is derived from PFObject so it has same properties and methods and transparently encrypts the fields values that were set via IQryptParseConfigurator.encryptField(...) method. Example:

IQryptParseConfigurator.encryptField("Armor", fieldKey: "myIntField", encryptionType: EncryptionType.OPE,fieldTemplate: NSNumber(int: 0));
IQryptParseConfigurator.encryptField("Armor", fieldKey: "myStringField", encryptionType: EncryptionType.DET,fieldTemplate: nil);

//create new object of Class named Armor
var obj = IQryptPFObject("Armor");
obj.setValue(30, forKey:"myIntField"); // 30 value is encrypted with OPE encryption scheme automatically
obj.setValue("Sensitive_Info", forKey:"myStringField"); // the string is encrypted with DET encryption scheme automatically

IQryptPFObject let you mix encrypted fields and non-encrypted fields, so you can encrypt only desired fields. For example the following field value will not be encrypted because it was not set to be encrypted via IQryptParseConfigurator.encryptField(...) method:

obj.setValue("non_sensitive_info",forKey:"myPlainTextField" );

Data Types

At this moment there are 3 types of encryption schemes that you can set to encrypt field values. Each encryption scheme allows different data types to be stored.

  • OPE - order preserving encryption - allows you to store following field types: Int, Float, NSDate

  • DET - deterministic encryption - allows you to store any type that can be serialized to JSON: NSNUmber, NSDate, NSDictionary and NSArray.

  • RND - randomized encryption - allows you to store any type that can be serialized to JSON: NSNUmber, NSDate, NSDictionary and NSArray.

Example:


IQryptParseConfigurator.encryptField("Armor", fieldKey: "myIntField", encryptionType: EncryptionType.OPE,fieldTemplate: NSNumber(int: 0));
IQryptParseConfigurator.encryptField("Armor", fieldKey: "myStringField", encryptionType: EncryptionType.DET,fieldTemplate: nil);
IQryptParseConfigurator.encryptField("Armor", fieldKey: "myDoc", encryptionType: EncryptionType.RND,fieldTemplate: nil);


//create new object of Class named Armor
var obj = IQryptPFObject("Armor");
obj.setValue(30,forKey:"myIntField"); // 30 value is encrypted with OPE encryption scheme automatically
obj.setValue( "Sensitive_Info",forKey:"myStringField"); // the string is encrypted with DET encryption scheme automatically
obj.setValue( "SensitiveData",forKey:"myDoc"); // the SensitiveData will be serialized to JSON and then encrypted with RND scheme

Inside Parse, all encrypted fields are stored in a String field type. You can see encrypted values via Parse Data Browser.