Appfigurate™️
HomeDocumentation
  • Introducing Appfigurate™️ 3
  • Getting Started
    • Getting Started
    • Examples
    • Upgrade guide
      • v1.4.0 to v2.2.0
      • v2.1.1 to v2.2.0
      • v2.2.1 to v3.0.0
      • v3.2.1 to v4.0.0
    • iOS native app integration
      • iOS app extension integration
    • watchOS app integration
      • watchOS app extension integration
    • Android native app integration
    • Mobile Flutter integration
      • Flutter iOS
      • Flutter Android
    • React Native integration
      • iOS native module integration
      • Android native module integration
      • JavaScript integration
    • Third party remote configuration providers
      • Firebase Remote Config
      • Launch Darkly
      • Other third party remote configuration providers
  • Configuration subclasses
    • Supported property types
      • Boolean
      • Integer
      • Float
      • Double
      • Plain String
      • Encrypted String
    • Custom executable actions
    • Slider icon types
  • Additional reading
    • Info.plist options
    • AndroidManifest.xml options
    • Displaying overridden configuration
    • Security
      • Best practice
      • Encryption
      • Export compliance
      • App Store compliance
      • PrivacyInfo.xcprivacy
      • Rotating your private key
  • Automation testing
    • iOS native app automation testing
    • Android native automation testing
  • API
    • iOS and watchOS API
    • Android API
    • Mobile Flutter API
    • React Native API
  • Appfigurate User Guide
    • Introduction
    • Main menu
    • Select app
    • Add app
    • Import app
    • Install example apps
    • Settings
      • Passcode Lock
      • Restore
      • Backup
      • Delete all apps and Settings
      • Analytics
    • Edit app
    • Configure app
    • Permissions
  • Appfigurate SE user guide
    • Introduction
    • Manual encryption
      • ENCRYPTED_STRING macro/function
      • ENCRYPTED_STRING_IOS_WATCHOS macro/function
    • Setup iOS Simulator app
    • Setup Android Emulator app
    • Xcode source editor extension
      • Troubleshooting
    • Real device cloud testing services
      • BrowserStack
  • LEGAL
    • License Agreement
    • Privacy Policy
    • Release History
    • Third party notices
Powered by GitBook
On this page
  • Step 1. Copy the public key
  • Step 2. Paste into the Public Key text field
  • Step 3. Copy the plaintext value
  • Step 4. Paste into the Plaintext text field
  • Step 5. Copy the ciphertext value
  • Step 6. Paste into your subclass
  1. Appfigurate SE user guide
  2. Manual encryption

ENCRYPTED_STRING macro/function

PreviousManual encryptionNextENCRYPTED_STRING_IOS_WATCHOS macro/function

Last updated 5 months ago

iOS/watchOS: where the APLConfiguration subclass has one public key, use the ENCRYPTED_STRING macro/function for each list item in the (Objective-C) macro or (Swift) property wrapper.

Android: each 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 .

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):

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.

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

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

The ciphertext will be computed automatically. e.g.:

Copy the ciphertext value.

Paste the ciphertext into:

ENCRYPTED_STRING_PROPERTY_LIST_EDIT
@EncryptedStringPropertyListEdit
@EncryptedStringPropertyListEdit
BuildConfig.ENCRYPTED