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

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";

Step 2. Paste into the Public Key text field

Step 3. Copy the plaintext value

  • 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.

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
    )}); 

Copy just the plaintext value without surrounding quotes as follows:

https://dev.appfigurate.io/list

Step 4. Paste into the Plaintext text field

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

Step 6. Paste into your subclass

  • 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.

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
    )});

Last updated