Links
Comment on page

ENCRYPTED_STRING macro/function

iOS/watchOS: where the APLConfiguration subclass has one public key, use the ENCRYPTED_STRING macro/function for each list item in the ENCRYPTED_STRING_PROPERTY_LIST_EDIT (Objective-C) macro or @EncryptedStringPropertyListEdit (Swift) property wrapper.
Android: each @EncryptedStringPropertyListEdit annotation will have a corresponding static initialiser block that inserts either a plaintext string or ciphertext string into a Map depending on the value of BuildConfig.ENCRYPTED.

Step 1. Copy the public key

You can copy the multi line string including the return keyword and line breaks as follows (do not include any comments or #if macros):
Objective-C
Swift
Java
Kotlin
return @"-----BEGIN PUBLIC KEY-----\n" \
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4TZnKfGeXttN7Rr3eiAZ\n" \
"PMEPsZvbo7lgIpMh6OjgBsoqkJJP0yXXLtpqsBCv8vm7RYqCn5+yfkiCQiXvkJBz\n" \
"FSKmLF9EPR9l1H+32Id82dDuseD70D66puPUHjciEgmU18DpW2NVvTAykMwTEsiR\n" \
"0h/ExBEhUe75qtwlVno8cMFbEfVtiGbKECvWIr122ED71T0Jt2Bcxqx1a7c1hPIV\n" \
"RwLxIfWfE0+2rB9nJVPBgsTVPywibDvjio82FousyMDmvkAbMq5iyuyvJ0+5bATz\n" \
"o12GEt5lSiQlCMzfmkWYBROMDCh27qGFVVo1XAUCVsMfsW9n4iQcoLAdUp/LI3B3\n" \
"ywIDAQAB\n" \
"-----END PUBLIC KEY-----\n";
return "-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4TZnKfGeXttN7Rr3eiAZ\n" +
"PMEPsZvbo7lgIpMh6OjgBsoqkJJP0yXXLtpqsBCv8vm7RYqCn5+yfkiCQiXvkJBz\n" +
"FSKmLF9EPR9l1H+32Id82dDuseD70D66puPUHjciEgmU18DpW2NVvTAykMwTEsiR\n" +
"0h/ExBEhUe75qtwlVno8cMFbEfVtiGbKECvWIr122ED71T0Jt2Bcxqx1a7c1hPIV\n" +
"RwLxIfWfE0+2rB9nJVPBgsTVPywibDvjio82FousyMDmvkAbMq5iyuyvJ0+5bATz\n" +
"o12GEt5lSiQlCMzfmkWYBROMDCh27qGFVVo1XAUCVsMfsW9n4iQcoLAdUp/LI3B3\n" +
"ywIDAQAB\n" +
"-----END PUBLIC KEY-----\n"
return "-----BEGIN PUBLIC KEY-----\n"
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4TZnKfGeXttN7Rr3eiAZ\n"
+ "PMEPsZvbo7lgIpMh6OjgBsoqkJJP0yXXLtpqsBCv8vm7RYqCn5+yfkiCQiXvkJBz\n"
+ "FSKmLF9EPR9l1H+32Id82dDuseD70D66puPUHjciEgmU18DpW2NVvTAykMwTEsiR\n"
+ "0h/ExBEhUe75qtwlVno8cMFbEfVtiGbKECvWIr122ED71T0Jt2Bcxqx1a7c1hPIV\n"
+ "RwLxIfWfE0+2rB9nJVPBgsTVPywibDvjio82FousyMDmvkAbMq5iyuyvJ0+5bATz\n"
+ "o12GEt5lSiQlCMzfmkWYBROMDCh27qGFVVo1XAUCVsMfsW9n4iQcoLAdUp/LI3B3\n"
+ "ywIDAQAB\n"
+ "-----END PUBLIC KEY-----\n";
return """
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4TZnKfGeXttN7Rr3eiAZ
PMEPsZvbo7lgIpMh6OjgBsoqkJJP0yXXLtpqsBCv8vm7RYqCn5+yfkiCQiXvkJBz
FSKmLF9EPR9l1H+32Id82dDuseD70D66puPUHjciEgmU18DpW2NVvTAykMwTEsiR
0h/ExBEhUe75qtwlVno8cMFbEfVtiGbKECvWIr122ED71T0Jt2Bcxqx1a7c1hPIV
RwLxIfWfE0+2rB9nJVPBgsTVPywibDvjio82FousyMDmvkAbMq5iyuyvJ0+5bATz
o12GEt5lSiQlCMzfmkWYBROMDCh27qGFVVo1XAUCVsMfsW9n4iQcoLAdUp/LI3B3
ywIDAQAB
-----END PUBLIC KEY-----
""".trimIndent()

Step 2. Paste into the Public Key text field

The public key will be reformatted automatically.

Step 3. Copy the plaintext value

Copy the plaintext value from:
  • the first parameter of the ENCRYPTED_STRING macro/function in Objective-C/Swift, or
  • the false condition of the ternary operator in Java or the if statement in Kotlin.
Objective-C
Swift
Java
Kotlin
ENCRYPTED_STRING_PROPERTY_LIST_EDIT(
url,
@"https://[\\w\\.-]+\\.appfigurate.io/.*",
@"server url",
@{@"Dev":ENCRYPTED_STRING(@"https://dev.appfigurate.io/list", // param 1 - plaintext
@"" // param 2 - ciphertext
)});
@EncryptedStringPropertyListEdit(
regex: #"https://[\w\.-]\.appfigurate.io/.*"#,
description: "server url",
encrypted: ENCRYPTED(),
restart: false,
values: ["Dev":ENCRYPTED_STRING("https://dev.appfigurate.io/list", // param 1 - plaintext
"")]) // param 2 - ciphertext
var url: String
_url.put("Dev", BuildConfig.ENCRYPTED ? "" : "https://dev.appfigurate.io/list");
_url["Dev"] = if (BuildConfig.ENCRYPTED) "" else "https://dev.appfigurate.io/list"
Copy just the plaintext value without surrounding quotes as follows:
https://dev.appfigurate.io/list

Step 4. Paste into the Plaintext text field

The ciphertext will be computed automatically. e.g.:
Bj+pIgNMhv+IRdmUJw6nzhKZmD14uAwe2jz50gYHSvkbgzUkmmpm+fjFsPrprljaPhu3w7xr1KuMkcbjdDpbFBoxSsOcZ3WuxjA5mHv1h/inZpi2/cAH/UjhshPO2VQ8FkWg9shduqCEDbjMuO8ammVA5x+zg7oVTPJXbJUH1P3I49f3Sc/Lg2LpxyEXIDFtgpYq5FX1qNa3mu842OMSkJ6NVEI+CDi4hRNz7P+ie2d8Dqlm+w0cvoV91Dc94bUveQsqiAcshTkqmlxxI5uZc+oKR8pQK+RX0pEZz+U2XR4herhDV3Qd/J8YAhL4qkIpxDMaYmiW7EK0RVszlwSDf/t+jPZE0cYVq3jF/ZYHh1S2k3mFRRnyO/gYgf5+SPB6AQ==
Note: due to the nature of RSA public key encryption, the ciphertext randomly changes for every modification you make.

Step 5. Copy the ciphertext value

Copy the ciphertext value.

Step 6. Paste into your subclass

Paste the ciphertext into:
  • the second parameter of the ENCRYPTED_STRING macro/function in Objective-C/Swift, or
  • the true condition of the ternary operator in Java or the if statement in Kotlin.
Objective-C
Swift
Java
Kotlin
ENCRYPTED_STRING_PROPERTY_LIST_EDIT(
url,
@"https://[\\w\\.-]+\\.appfigurate.io/.*",
@"server url",
@{@"Dev":ENCRYPTED_STRING(@"https://dev.appfigurate.io/list", // param 1 - plaintext
@"Bj+pIgNMhv+IRdmUJw6nzhKZmD14uAwe2jz50gYHSvkbgzUkmmpm+fjFsPrprljaPhu3w7xr1KuMkcbjdDpbFBoxSsOcZ3WuxjA5mHv1h/inZpi2/cAH/UjhshPO2VQ8FkWg9shduqCEDbjMuO8ammVA5x+zg7oVTPJXbJUH1P3I49f3Sc/Lg2LpxyEXIDFtgpYq5FX1qNa3mu842OMSkJ6NVEI+CDi4hRNz7P+ie2d8Dqlm+w0cvoV91Dc94bUveQsqiAcshTkqmlxxI5uZc+oKR8pQK+RX0pEZz+U2XR4herhDV3Qd/J8YAhL4qkIpxDMaYmiW7EK0RVszlwSDf/t+jPZE0cYVq3jF/ZYHh1S2k3mFRRnyO/gYgf5+SPB6AQ==" // param 2 - ciphertext
)});
@EncryptedStringPropertyListEdit(
regex: #"https://[\w\.-]\.appfigurate.io/.*"#,
description: "server url",
encrypted: ENCRYPTED(),
restart: false,
values: ["Dev":ENCRYPTED_STRING("https://dev.appfigurate.io/list", // param 1 - plaintext
"Bj+pIgNMhv+IRdmUJw6nzhKZmD14uAwe2jz50gYHSvkbgzUkmmpm+fjFsPrprljaPhu3w7xr1KuMkcbjdDpbFBoxSsOcZ3WuxjA5mHv1h/inZpi2/cAH/UjhshPO2VQ8FkWg9shduqCEDbjMuO8ammVA5x+zg7oVTPJXbJUH1P3I49f3Sc/Lg2LpxyEXIDFtgpYq5FX1qNa3mu842OMSkJ6NVEI+CDi4hRNz7P+ie2d8Dqlm+w0cvoV91Dc94bUveQsqiAcshTkqmlxxI5uZc+oKR8pQK+RX0pEZz+U2XR4herhDV3Qd/J8YAhL4qkIpxDMaYmiW7EK0RVszlwSDf/t+jPZE0cYVq3jF/ZYHh1S2k3mFRRnyO/gYgf5+SPB6AQ==")]) // param 2 - ciphertext
var url: String
_url.put("Dev", BuildConfig.ENCRYPTED ? "Bj+pIgNMhv+IRdmUJw6nzhKZmD14uAwe2jz50gYHSvkbgzUkmmpm+fjFsPrprljaPhu3w7xr1KuMkcbjdDpbFBoxSsOcZ3WuxjA5mHv1h/inZpi2/cAH/UjhshPO2VQ8FkWg9shduqCEDbjMuO8ammVA5x+zg7oVTPJXbJUH1P3I49f3Sc/Lg2LpxyEXIDFtgpYq5FX1qNa3mu842OMSkJ6NVEI+CDi4hRNz7P+ie2d8Dqlm+w0cvoV91Dc94bUveQsqiAcshTkqmlxxI5uZc+oKR8pQK+RX0pEZz+U2XR4herhDV3Qd/J8YAhL4qkIpxDMaYmiW7EK0RVszlwSDf/t+jPZE0cYVq3jF/ZYHh1S2k3mFRRnyO/gYgf5+SPB6AQ==" : "https://dev.appfigurate.io/list");
_url["Dev"] = if (BuildConfig.ENCRYPTED) "Bj+pIgNMhv+IRdmUJw6nzhKZmD14uAwe2jz50gYHSvkbgzUkmmpm+fjFsPrprljaPhu3w7xr1KuMkcbjdDpbFBoxSsOcZ3WuxjA5mHv1h/inZpi2/cAH/UjhshPO2VQ8FkWg9shduqCEDbjMuO8ammVA5x+zg7oVTPJXbJUH1P3I49f3Sc/Lg2LpxyEXIDFtgpYq5FX1qNa3mu842OMSkJ6NVEI+CDi4hRNz7P+ie2d8Dqlm+w0cvoV91Dc94bUveQsqiAcshTkqmlxxI5uZc+oKR8pQK+RX0pEZz+U2XR4herhDV3Qd/J8YAhL4qkIpxDMaYmiW7EK0RVszlwSDf/t+jPZE0cYVq3jF/ZYHh1S2k3mFRRnyO/gYgf5+SPB6AQ==" else "https://dev.appfigurate.io/list"