Skip to content

Commit 2e1767e

Browse files
committed
Merge branch 'main' into dabritch-net8
2 parents d941e7a + 21bcc15 commit 2e1767e

File tree

5 files changed

+465
-11
lines changed

5 files changed

+465
-11
lines changed

docs/TOC.yml

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
href: migration/app-properties.md
9090
- name: Migrate secure storage data
9191
href: migration/secure-storage.md
92+
- name: Migrate version tracking data
93+
href: migration/version-tracking.md
9294
- name: Tutorials
9395
items:
9496
- name: Create a .NET MAUI app

docs/migration/app-properties.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ The following code shows the `LegacyApplication` class, which provides access to
2121
> To use this code, add it to a class named `LegacyApplication` in your .NET MAUI app project.
2222
2323
```csharp
24+
namespace MigrationHelpers;
25+
2426
public class LegacyApplication
2527
{
26-
readonly PropertiesDeserializer _deserializer;
27-
Task<IDictionary<string, object>>? _propertiesTask;
28+
readonly PropertiesDeserializer deserializer;
29+
Task<IDictionary<string, object>>? propertiesTask;
2830

2931
static LegacyApplication? current;
3032
public static LegacyApplication? Current
@@ -38,21 +40,21 @@ public class LegacyApplication
3840

3941
public LegacyApplication()
4042
{
41-
_deserializer = new PropertiesDeserializer();
43+
deserializer = new PropertiesDeserializer();
4244
}
4345

4446
public IDictionary<string, object> Properties
4547
{
4648
get
4749
{
48-
_propertiesTask ??= GetPropertiesAsync();
49-
return _propertiesTask.Result;
50+
propertiesTask ??= GetPropertiesAsync();
51+
return propertiesTask.Result;
5052
}
5153
}
5254

5355
async Task<IDictionary<string, object>> GetPropertiesAsync()
5456
{
55-
IDictionary<string, object> properties = await _deserializer.DeserializePropertiesAsync().ConfigureAwait(false);
57+
IDictionary<string, object> properties = await deserializer.DeserializePropertiesAsync().ConfigureAwait(false);
5658
properties ??= new Dictionary<string, object>(4);
5759
return properties;
5860
}

docs/migration/includes/compile-troubleshoot.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
ms.topic: include
3-
ms.date: 10/02/2023
3+
ms.date: 10/06/2023
44
---
55

66
## Compile and troubleshoot
@@ -29,4 +29,5 @@ The following table provides guidance for overcoming common build or runtime iss
2929
| Custom renderer doesn't work. | Renderer code needs updating to work in .NET MAUI. For more information, see [Use custom renderers in .NET MAUI](../custom-renderers.md). |
3030
| Effect doesn't work. | Effect code needs updating to work in .NET MAUI. For more information, see [Use effects in .NET MAUI](../effects.md). |
3131
| Can't access previously created app properties data. | Migrate the app properties data to .NET MAUI preferences. For more information, see [Migrate data from the Xamarin.Forms app properties dictionary to .NET MAUI preferences](../app-properties.md). |
32-
| Can't access previously created secure storage. | There are implementation differences between the `SecureStorage` class in Xamarin.Essentials and .NET MAUI. For more information, see [Migrate from Xamarin.Essentials secure storage to .NET MAUI secure storage](../secure-storage.md). |
32+
| Can't access previously created secure storage data. | Migrate the secure storage data to .NET MAUI. For more information, see [Migrate from Xamarin.Essentials secure storage to .NET MAUI secure storage](../secure-storage.md). |
33+
| Can't access previously created version tracking data. | Migrate the version tracking data to .NET MAUI. For more information, see [Migrate version tracking data from a Xamarin.Forms app to a .NET MAUI app](../version-tracking.md). |

docs/migration/secure-storage.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Xamarin.Essentials and .NET Multi-platform App UI (.NET MAUI) both have a `Secur
1010

1111
| Platform | Xamarin.Essentials | .NET MAUI |
1212
| - | ------------------ | --------- |
13-
| Android | The Android KeyStore is used to store the cipher key used to encrypt a value before it's saved into a shared preferences object with a filename of {your-app-package-id}.xamarinessentials. | Data is encrypted with the `EncryptedSharedPreferences` class, which wraps the `SharedPreferences` class, and automatically encrypts keys and values. The filename used is {your-app-package-id}.microsoft.maui.essentials.preferences. |
13+
| Android | The Android KeyStore is used to store the cipher key used to encrypt a value before it's saved into a shared preferences object with a name of {your-app-package-id}.xamarinessentials. | Data is encrypted with the `EncryptedSharedPreferences` class, which wraps the `SharedPreferences` class, and automatically encrypts keys and values. The name used is {your-app-package-id}.microsoft.maui.essentials.preferences. |
1414
| iOS | KeyChain is used to store values securely. The `SecRecord` used to store values has a `Service` value set to {your-app-package-id}.xamarinessentials. | KeyChain is used to store values securely. The `SecRecord` used to store values has a `Service` value set to {your-app-package-id}.microsoft.maui.essentials.preferences. |
1515
<!-- | Windows | The `DataProtectionProvider` class is used to encrypt values securely. Encrypted values are stored in `ApplicationData.Current.LocalSettings`, inside a container with a name of {your-app-package-id}.xamarinessentials. | The `DataProtectionProvider` class is used to encrypt values securely. Encrypted values are stored in `ApplicationData.Current.LocalSettings`, inside a container with a name of {your-app-package-id}.microsoft.maui.essentials.preferences. | -->
1616

@@ -91,7 +91,7 @@ public class LegacySecureStorage
9191

9292
### Android
9393

94-
On Android, the `LegacySecureStorage` class uses the `AndroidKeyStore` class to store the cipher key used to encrypt a value before it's saved into a shared preferences object with a filename of {your-app-package-id}.xamarinessentials. The following code shows the `AndroidKeyStore` class:
94+
On Android, the `LegacySecureStorage` class uses the `AndroidKeyStore` class to store the cipher key used to encrypt a value before it's saved into a shared preferences object with a name of {your-app-package-id}.xamarinessentials. The following code shows the `AndroidKeyStore` class:
9595

9696
> [!NOTE]
9797
> To use this code, add it to a class named `AndroidKeyStore` in the *Platforms\Android* folder of your .NET MAUI app project.
@@ -347,7 +347,7 @@ class AndroidKeyStore
347347
}
348348
```
349349

350-
The [Android KeyStore](https://developer.android.com/training/articles/keystore.html) is used to store the cipher key used to encrypt the value before it is saved into a [Shared Preferences](https://developer.android.com/training/data-storage/shared-preferences.html)file with a filename of *{your-app-package-id}.xamarinessentials*. The key (not a cryptographic key, the *key* to the *value*) used in the shared preferences file is a *MD5 Hash* of the key passed into the `SecureStorage` APIs.
350+
The [Android KeyStore](https://developer.android.com/training/articles/keystore.html) is used to store the cipher key used to encrypt the value before it is saved into a [Shared Preferences](https://developer.android.com/training/data-storage/shared-preferences.html)file with a name of *{your-app-package-id}.xamarinessentials*. The key (not a cryptographic key, the *key* to the *value*) used in the shared preferences file is a *MD5 Hash* of the key passed into the `SecureStorage` APIs.
351351
352352
On API 23+, an **AES** key is obtained from the Android KeyStore and used with an **AES/GCM/NoPadding** cipher to encrypt the value before it is stored in the shared preferences file. On API 22 and lower, the Android KeyStore only supports storing **RSA** keys, which is used with an **RSA/ECB/PKCS1Padding** cipher to encrypt an **AES** key (randomly generated at runtime) and stored in the shared preferences file under the key _SecureStorageKey_, if one has not already been generated.
353353

0 commit comments

Comments
 (0)