1- #if ! ( ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER ) || NUGETFORUNITY_CLI )
1+ #pragma warning disable SA1512 , SA1124 // Single-line comments should not be followed by blank line
2+ #if ! ( ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER && NET_STANDARD ) || NUGETFORUNITY_CLI )
23using JetBrains . Annotations ;
34#else
45using System . Security . Cryptography ;
56#endif
7+
8+ #region No ReShaper
9+
10+ // ReSharper disable All
11+ // needed because 'JetBrains.Annotations.NotNull' and 'System.Diagnostics.CodeAnalysis.NotNull' collide if this file is compiled with a never version of Unity / C#
12+ using SuppressMessageAttribute = System . Diagnostics . CodeAnalysis . SuppressMessageAttribute ;
13+
14+ // ReSharper restore All
15+
16+ #endregion
17+
618using System ;
7- using System . Diagnostics . CodeAnalysis ;
819using System . Text ;
920using UnityEngine ;
1021
1122namespace NugetForUnity . Configuration
1223{
1324 /// <summary>
14- /// Helper to encrypt sensitive data so they don't need to be stored in plaintext inside the configuration file.
25+ /// Helper to encrypt sensitive data so they don't need to be stored in plain-text inside the configuration file.
1526 /// </summary>
1627 internal static class ConfigurationEncryptionHelper
1728 {
1829 private static readonly byte [ ] EntropyBytes = Encoding . UTF8 . GetBytes ( "NuGet" ) ;
1930
20- #if ! ( ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER ) || NUGETFORUNITY_CLI )
31+ #if ! ( ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER && NET_STANDARD ) || NUGETFORUNITY_CLI )
2132
2233 // on .net framework the type lives in 'System.Security' on .net standard it in 'System.Security.Cryptography.ProtectedData'
2334 [ ItemCanBeNull ]
@@ -44,7 +55,7 @@ public static string EncryptString(string value)
4455 {
4556 var decryptedByteArray = Encoding . UTF8 . GetBytes ( value ) ;
4657
47- #if ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER ) || NUGETFORUNITY_CLI
58+ #if ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER && NET_STANDARD ) || NUGETFORUNITY_CLI
4859#pragma warning disable CA1416 // Validate platform compatibility
4960 var encryptedByteArray = ProtectedData . Protect ( decryptedByteArray , EntropyBytes , DataProtectionScope . CurrentUser ) ;
5061#pragma warning restore CA1416 // Validate platform compatibility
@@ -86,7 +97,7 @@ public static string DecryptString(string encryptedString)
8697 {
8798 var encryptedByteArray = Convert . FromBase64String ( encryptedString ) ;
8899
89- #if ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER ) || NUGETFORUNITY_CLI
100+ #if ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER && NET_STANDARD ) || NUGETFORUNITY_CLI
90101#pragma warning disable CA1416 // Validate platform compatibility
91102 var decryptedByteArray = ProtectedData . Unprotect ( encryptedByteArray , EntropyBytes , DataProtectionScope . CurrentUser ) ;
92103#pragma warning restore CA1416 // Validate platform compatibility
@@ -110,7 +121,7 @@ public static string DecryptString(string encryptedString)
110121 }
111122 }
112123
113- #if ! ( ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER ) || NUGETFORUNITY_CLI )
124+ #if ! ( ( UNITY_EDITOR_WIN && UNITY_2023_1_OR_NEWER && NET_STANDARD ) || NUGETFORUNITY_CLI )
114125 [ CanBeNull ]
115126 private static byte [ ] ProtectOrUnprotectUsingReflection ( string methodName , byte [ ] data )
116127 {
0 commit comments