Links
Comment on page

ENCRYPTED_STRING_IOS_WATCHOS macro/function

For an iOS and watchOS app where the APLConfiguration subclass has two public keys, use the ENCRYPTED_STRING_IOS_WATCHOS macro/function for each list item in the ENCRYPTED_STRING_PROPERTY_LIST_EDIT (Objective-C) macro or @EncryptedStringPropertyListEdit (Swift) property wrapper.

iOS

Step 1. Copy the iOS public key

Objective-C
Swift
- (NSString*) publicKey {
#if TARGET_OS_IOS
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";
#elif TARGET_OS_WATCH
return @"-----BEGIN PUBLIC KEY-----\n" \
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArxgy6NU0IsJxLSZqcZzJ\n" \
"pcUpdYEyPSWsrwryiMq5evIZQ86xOmj9q4VEUOTr+rgg/Pu7BaNQ8NedvU4nWhVB\n" \
"OYe84zMjofzFMj0XNoFiCf7lAKaRfy/mzC+BCPWCtau5PQqkTmANjO2fZwuHsk+4\n" \
"cr1IIvjm0vSMfCdrPoydG8sl1KwgWzXvaKkMKkWmT+Ss2HxewFShgzeoqeJOoZ2M\n" \
"7c16q8k+yL7kwhq8a+p0iF6yVVUI3263KbGHCU5eG/4JT2sFzt7yBy7Rqj1l62PZ\n" \
"R0TjFxVFB+NTjeKPady/bFl2ZroGITchWJ/hTGkkUKZYu1t6xhOTxNiKq6/FNqzR\n" \
"QQIDAQAB\n" \
"-----END PUBLIC KEY-----\n";
#endif
}
override func publicKey() -> String {
#if os(iOS)
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"
#elseif os(watchOS)
return "-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArxgy6NU0IsJxLSZqcZzJ\n" +
"pcUpdYEyPSWsrwryiMq5evIZQ86xOmj9q4VEUOTr+rgg/Pu7BaNQ8NedvU4nWhVB\n" +
"OYe84zMjofzFMj0XNoFiCf7lAKaRfy/mzC+BCPWCtau5PQqkTmANjO2fZwuHsk+4\n" +
"cr1IIvjm0vSMfCdrPoydG8sl1KwgWzXvaKkMKkWmT+Ss2HxewFShgzeoqeJOoZ2M\n" +
"7c16q8k+yL7kwhq8a+p0iF6yVVUI3263KbGHCU5eG/4JT2sFzt7yBy7Rqj1l62PZ\n" +
"R0TjFxVFB+NTjeKPady/bFl2ZroGITchWJ/hTGkkUKZYu1t6xhOTxNiKq6/FNqzR\n" +
"QQIDAQAB\n" +
"-----END PUBLIC KEY-----\n"
#endif
}
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
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"

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_IOS_WATCHOS macro/function.
Objective-C
Swift
ENCRYPTED_STRING_PROPERTY_LIST_EDIT(
url,
@"https://[\\w\\.-]+\\.appfigurate.io/.*",
@"server url",
@{@"Dev": ENCRYPTED_STRING_IOS_WATCHOS(@"https://dev.appfigurate.io/list", // param 1 - plaintext
@"", // param 2 - iOS ciphertext
@"" // param 3 - watchOS ciphertext
)});
@EncryptedStringPropertyListEdit(
regex: #"https://[\w\.-]\.appfigurate.io/.*"#,
description: "server url",
encrypted: ENCRYPTED(),
restart: false,
values: ["Dev": ENCRYPTED_STRING_IOS_WATCHOS("https://dev.appfigurate.io/list", // param 1 - plaintext
"", // param 2 - iOS ciphertext
"")]) // param 3 - watchOS ciphertext
var url: String
Copy just the plain text 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 cipher text randomly changes for every modification you make.

Step 5. Copy the ciphertext value

Copy the ciphertext value.
Objective-C
Swift
ENCRYPTED_STRING_PROPERTY_LIST_EDIT(
url,
@"https://[\\w\\.-]+\\.appfigurate.io/.*",
@"server url",
@{@"Dev": ENCRYPTED_STRING_IOS_WATCHOS(@"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 - iOS ciphertext
@"" // param 3 - watchOS ciphertext
)});
@EncryptedStringPropertyListEdit(
regex: #"https://[\w\.-]\.appfigurate.io/.*"#,
description: "server url",
encrypted: ENCRYPTED(),
restart: false,
values: ["Dev": ENCRYPTED_STRING_IOS_WATCHOS("https://dev.appfigurate.io/list", // param 1 - plain text
"Bj+pIgNMhv+IRdmUJw6nzhKZmD14uAwe2jz50gYHSvkbgzUkmmpm+fjFsPrprljaPhu3w7xr1KuMkcbjdDpbFBoxSsOcZ3WuxjA5mHv1h/inZpi2/cAH/UjhshPO2VQ8FkWg9shduqCEDbjMuO8ammVA5x+zg7oVTPJXbJUH1P3I49f3Sc/Lg2LpxyEXIDFtgpYq5FX1qNa3mu842OMSkJ6NVEI+CDi4hRNz7P+ie2d8Dqlm+w0cvoV91Dc94bUveQsqiAcshTkqmlxxI5uZc+oKR8pQK+RX0pEZz+U2XR4herhDV3Qd/J8YAhL4qkIpxDMaYmiW7EK0RVszlwSDf/t+jPZE0cYVq3jF/ZYHh1S2k3mFRRnyO/gYgf5+SPB6AQ==", // param 2 - iOS cipher text
"")]) // param 3 - watchOS cipher text
var url: String

Step 6. Paste into your subclass

Paste the ciphertext into the second parameter of the ENCRYPTED_STRING_IOS_WATCHOS macro/function.

watchOS

Step 1. Copy the watchOS 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
return @"-----BEGIN PUBLIC KEY-----\n" \
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArxgy6NU0IsJxLSZqcZzJ\n" \
"pcUpdYEyPSWsrwryiMq5evIZQ86xOmj9q4VEUOTr+rgg/Pu7BaNQ8NedvU4nWhVB\n" \
"OYe84zMjofzFMj0XNoFiCf7lAKaRfy/mzC+BCPWCtau5PQqkTmANjO2fZwuHsk+4\n" \
"cr1IIvjm0vSMfCdrPoydG8sl1KwgWzXvaKkMKkWmT+Ss2HxewFShgzeoqeJOoZ2M\n" \
"7c16q8k+yL7kwhq8a+p0iF6yVVUI3263KbGHCU5eG/4JT2sFzt7yBy7Rqj1l62PZ\n" \
"R0TjFxVFB+NTjeKPady/bFl2ZroGITchWJ/hTGkkUKZYu1t6xhOTxNiKq6/FNqzR\n" \
"QQIDAQAB\n" \
"-----END PUBLIC KEY-----\n";
return "-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArxgy6NU0IsJxLSZqcZzJ\n" +
"pcUpdYEyPSWsrwryiMq5evIZQ86xOmj9q4VEUOTr+rgg/Pu7BaNQ8NedvU4nWhVB\n" +
"OYe84zMjofzFMj0XNoFiCf7lAKaRfy/mzC+BCPWCtau5PQqkTmANjO2fZwuHsk+4\n" +
"cr1IIvjm0vSMfCdrPoydG8sl1KwgWzXvaKkMKkWmT+Ss2HxewFShgzeoqeJOoZ2M\n" +
"7c16q8k+yL7kwhq8a+p0iF6yVVUI3263KbGHCU5eG/4JT2sFzt7yBy7Rqj1l62PZ\n" +
"R0TjFxVFB+NTjeKPady/bFl2ZroGITchWJ/hTGkkUKZYu1t6xhOTxNiKq6/FNqzR\n" +
"QQIDAQAB\n" +
"-----END PUBLIC KEY-----\n"

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_IOS_WATCHOS macro/function.
Objective-C
Swift
ENCRYPTED_STRING_PROPERTY_LIST_EDIT(
url,
@"https://[\\w\\.-]+\\.appfigurate.io/.*",
@"server url",
@{@"Dev": ENCRYPTED_STRING_IOS_WATCHOS(@"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 - iOS ciphertext
@"" // param 3 - watchOS ciphertext
)});
@EncryptedStringPropertyListEdit(
regex: #"https://[\w\.-]\.appfigurate.io/.*"#,
description: "server url",
encrypted: ENCRYPTED(),
restart: false,
values: ["Dev": ENCRYPTED_STRING_IOS_WATCHOS("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 - iOS ciphertext
"")]) // param 3 - watchOS ciphertext
var url: String
Copy just the plain text 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.:
wUSKc6eNUXnsQyTBn1O91gczDtw6zpzRUHHb613Y3kqyhL3MNwpYWwGCN6Q9m5apibl5etf8ceMRnjU2JprwcWY/PTs+sYshRgfBRuO/kALXThJpRBmWnbptLZIvp5anQdZ9So09a2kFvkZFGWaUkNcExXlfXLGdFBmwRGwaq7q2+Y+eKvNvY2qSEBQ9oV7kx9KT0BabLjulKh1023zCZgFK/oifHJShaEiUJ4bKT3OQiIcSo7z1O7pV470ozgon9y0bLTA0H0se3CCNCcrSY5ZIzcI0nTF20Er/6L5/PwPq1Ea0JBLsaAdLVSiXjqGgnU2oqAxzTso6FvikEeGS81jlQ8WlebTyebxFyffGfRqNpWkxB10DuaVMO4XK4UFTAQ==
Note: due to the nature of RSA public key encryption, the cipher text 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 third parameter of the ENCRYPTED_STRING_IOS_WATCHOS macro/function.
Objective-C
Swift
ENCRYPTED_STRING_PROPERTY_LIST_EDIT(
url,
@"https://[\\w\\.-]+\\.appfigurate.io/.*",
@"server url",
@{@"Dev": ENCRYPTED_STRING_IOS_WATCHOS(@"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 - iOS ciphertext
@"wUSKc6eNUXnsQyTBn1O91gczDtw6zpzRUHHb613Y3kqyhL3MNwpYWwGCN6Q9m5apibl5etf8ceMRnjU2JprwcWY/PTs+sYshRgfBRuO/kALXThJpRBmWnbptLZIvp5anQdZ9So09a2kFvkZFGWaUkNcExXlfXLGdFBmwRGwaq7q2+Y+eKvNvY2qSEBQ9oV7kx9KT0BabLjulKh1023zCZgFK/oifHJShaEiUJ4bKT3OQiIcSo7z1O7pV470ozgon9y0bLTA0H0se3CCNCcrSY5ZIzcI0nTF20Er/6L5/PwPq1Ea0JBLsaAdLVSiXjqGgnU2oqAxzTso6FvikEeGS81jlQ8WlebTyebxFyffGfRqNpWkxB10DuaVMO4XK4UFTAQ==" // param 3 - watchOS ciphertext
)});
@EncryptedStringPropertyListEdit(
regex: #"https://[\w\.-]\.appfigurate.io/.*"#,
description: "server url",
encrypted: ENCRYPTED(),
restart: false,
values: ["Dev": ENCRYPTED_STRING_IOS_WATCHOS("https://dev.appfigurate.io/list", // param 1 - plain text
"Bj+pIgNMhv+IRdmUJw6nzhKZmD14uAwe2jz50gYHSvkbgzUkmmpm+fjFsPrprljaPhu3w7xr1KuMkcbjdDpbFBoxSsOcZ3WuxjA5mHv1h/inZpi2/cAH/UjhshPO2VQ8FkWg9shduqCEDbjMuO8ammVA5x+zg7oVTPJXbJUH1P3I49f3Sc/Lg2LpxyEXIDFtgpYq5FX1qNa3mu842OMSkJ6NVEI+CDi4hRNz7P+ie2d8Dqlm+w0cvoV91Dc94bUveQsqiAcshTkqmlxxI5uZc+oKR8pQK+RX0pEZz+U2XR4herhDV3Qd/J8YAhL4qkIpxDMaYmiW7EK0RVszlwSDf/t+jPZE0cYVq3jF/ZYHh1S2k3mFRRnyO/gYgf5+SPB6AQ==", // param 2 - iOS cipher text
"wUSKc6eNUXnsQyTBn1O91gczDtw6zpzRUHHb613Y3kqyhL3MNwpYWwGCN6Q9m5apibl5etf8ceMRnjU2JprwcWY/PTs+sYshRgfBRuO/kALXThJpRBmWnbptLZIvp5anQdZ9So09a2kFvkZFGWaUkNcExXlfXLGdFBmwRGwaq7q2+Y+eKvNvY2qSEBQ9oV7kx9KT0BabLjulKh1023zCZgFK/oifHJShaEiUJ4bKT3OQiIcSo7z1O7pV470ozgon9y0bLTA0H0se3CCNCcrSY5ZIzcI0nTF20Er/6L5/PwPq1Ea0JBLsaAdLVSiXjqGgnU2oqAxzTso6FvikEeGS81jlQ8WlebTyebxFyffGfRqNpWkxB10DuaVMO4XK4UFTAQ==")]) // param 3 - watchOS cipher text
var url: String