Encrypted String
Last updated
Last updated
The default value of an encrypted String
is nil. You must change the default value of the property by assigning a new plain text value in an overridden reset
method.
This page describes encrypted strings. Appfigurate also supports plain textual strings.
Allows a string property to be changed in Appfigurate by allowing the user to select from a predefined list of valid choices. The user can customize the list adding by additional values using a text field and an optional regular expression validating input.
Swift @EncryptedStringPropertyListEdit prototype
The encrypted
parameter of EncryptedStringPropertyListEdit
must be the result of calling the ENCRYPTED()
function. e.g.
Swift @EncryptedStringPropertyListEdit example
Swift ENCRYPTED_STRING prototype
For an iOS app (or watchOS and it's companion iOS app) where the APLConfiguration
subclass has one public key use the ENCRYPTED_STRING
function for each list item in the @EncryptedStringPropertyListEdit
.
The first parameter of the ENCRYPTED_STRING
function is the plaintext, and will be used by DEBUG
builds. The second parameter of the ENCRYPTED_STRING
macro is the ciphertext, and will be used by RELEASE
builds. To generate the ciphertext, use the source editor extension for Xcode or AppfigurateSE app.
Swift ENCRYPTED_STRING example
Note: Using different public keys and the ENCRYPTED_STRING_IOS_WATCHOS function for watchOS and it's companion iOS app is deprecated will be removed in the upcoming Appfigurate 4 release. Migrate to shared public keys and the ENCRYPTED_STRING function instead.
Swift ENCRYPTED_STRING_IOS_WATCHOS prototype
For an iOS and watchOS app where the APLConfiguration
subclass has two public keys, use the ENCRYPTED_STRING_IOS_WATCHOS
function for each list item in the @EncryptedStringPropertyListEdit
.
The first parameter of the ENCRYPTED_STRING
function is the plaintext, and will be used by DEBUG
builds. The second and third parameters of the ENCRYPTED_STRING
function are the ciphertext for iOS and watchOS apps, and will be used by RELEASE
builds. To generate the ciphertext, use the source editor extension for Xcode or AppfigurateSE app.
Swift ENCRYPTED_STRING_IOS_WATCHOS example
Swift ENCRYPTED prototype
Used in conjunction with the @EncryptedStringPropertyListEdit
property wrapper. The encrypted
parameter of @EncryptedStringPropertyListEdit
must be the result of calling the ENCRYPTED()
function. e.g.
The function returns true
if the calling app has been compiled in RELEASE mode or false
if the calling app has been compiled in DEBUG mode.
Warning: The ENCRYPTED function will behave incorrectly if the apps build settings Swift compiler - Code generation ‣ Optimization Level
is set to Optimize for Size
(-Osize). The default Swift compiler optimization levels are No Optimization
for DEBUG
builds and Optimize for Speed
-Ospeed for RELEASE
builds. If you must use -Osize, then implement your own isEncrypted()
style function as follows:
Swift isEncrypted example
Then call your own isEncrypted()
function instead of the provided ENCRYPTED()
function e.g.
Using ENCRYPTED_STRING
and ENCRYPTED_STRING_IOS_WATCHOS
guarantees that the plaintext of the list item values will not be included in the resulting application binary, only the ciphertext. The ciphertext can only be decrypted by Appfigurate using the correct private key.
You can verify that the plain text is not included in the RELEASE application binary using the macOS strings
tool as follows:
Terminal
It is best practice to use ENCRYPTED_STRING
and ENCRYPTED_STRING_IOS_WATCHOS
to encrypt sensitive information such as server urls (e.g. internal test environments), rather than expose them as plain text.
Using a combination of BuildConfig.ENCRYPTED
and ProGuard guarantees that the plaintext of the list item values will not be included in the resulting application binary, only the ciphertext. The ciphertext can only be decrypted by Appfigurate using the correct private key.
You can verify that the plaintext is not included in the RELEASE build variant APK or AAB using the macOS strings tool as follows:
Terminal
The dex2jar
tool can be installed using brew.
Ensure you have read the encryption best practices for iOS and watchOS, and Android sections.
Ensure you have read the encryption best practices for iOS and watchOS, and Android sections.