diff options
author | Jay Krell <jay.krell@cornell.edu> | 2018-06-11 08:25:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-11 08:25:26 +0300 |
commit | 1b10d7d9b7e40dc0924fdba3c90689d008943aff (patch) | |
tree | 2ba54f6c438b7e385462aca12402ae3e5e86453b /mcs/class/Mono.Security | |
parent | 1a91bb9939838602f6c2cb89f414b5018ae763eb (diff) |
[Coop] Convert Mono.Security.Cryptography.KeyPairPersistence and System.Security.Principal.WindowsImpersonationContext. (#8608)
* [Coop] Convert Mono.Security.Cryptography.KeyPairPersistence and System.Security.Principal.WindowsImpersonationContext.
* Bump corlib version.
Diffstat (limited to 'mcs/class/Mono.Security')
-rw-r--r-- | mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs index 14f8c73a8ae..ea1160b3bb8 100644 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs +++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs @@ -275,19 +275,19 @@ namespace Mono.Security.Cryptography { #if INSIDE_CORLIB [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _CanSecure (string root); + unsafe internal static extern bool _CanSecure (char* root); [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _ProtectUser (string path); + unsafe internal static extern bool _ProtectUser (char* path); [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _ProtectMachine (string path); + unsafe internal static extern bool _ProtectMachine (char* path); [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _IsUserProtected (string path); + unsafe internal static extern bool _IsUserProtected (char* path); [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _IsMachineProtected (string path); + unsafe internal static extern bool _IsMachineProtected (char* path); #else // Mono.Security.dll assembly can't use the internal // call (and still run with other runtimes) @@ -295,34 +295,34 @@ namespace Mono.Security.Cryptography { // Note: Class is only available in Mono.Security.dll as // a management helper (e.g. build a GUI app) - internal static bool _CanSecure (string root) + unsafe internal static bool _CanSecure (char* root) { return true; } - internal static bool _ProtectUser (string path) + unsafe internal static bool _ProtectUser (char* path) { return true; } - internal static bool _ProtectMachine (string path) + unsafe internal static bool _ProtectMachine (char* path) { return true; } - internal static bool _IsUserProtected (string path) + unsafe internal static bool _IsUserProtected (char* path) { return true; } - internal static bool _IsMachineProtected (string path) + unsafe internal static bool _IsMachineProtected (char* path) { return true; } #endif // private stuff - private static bool CanSecure (string path) + unsafe private static bool CanSecure (string path) { // we assume POSIX filesystems can always be secured @@ -333,44 +333,54 @@ namespace Mono.Security.Cryptography { return true; // while we ask the runtime for Windows OS - return _CanSecure (Path.GetPathRoot (path)); + fixed (char* fpath = path) { + return _CanSecure (fpath); + } } - private static bool ProtectUser (string path) + unsafe private static bool ProtectUser (string path) { // we cannot protect on some filsystem (like FAT) if (CanSecure (path)) { - return _ProtectUser (path); + fixed (char* fpath = path) { + return _ProtectUser (fpath); + } } // but Mono still needs to run on them :( return true; } - private static bool ProtectMachine (string path) + unsafe private static bool ProtectMachine (string path) { // we cannot protect on some filsystem (like FAT) if (CanSecure (path)) { - return _ProtectMachine (path); + fixed (char* fpath = path) { + return _ProtectMachine (fpath); + } } // but Mono still needs to run on them :( return true; } - private static bool IsUserProtected (string path) + unsafe private static bool IsUserProtected (string path) { // we cannot protect on some filsystem (like FAT) if (CanSecure (path)) { - return _IsUserProtected (path); + fixed (char* fpath = path) { + return _IsUserProtected (fpath); + } } // but Mono still needs to run on them :( return true; } - private static bool IsMachineProtected (string path) + unsafe private static bool IsMachineProtected (string path) { // we cannot protect on some filsystem (like FAT) if (CanSecure (path)) { - return _IsMachineProtected (path); + fixed (char* fpath = path) { + return _IsMachineProtected (fpath); + } } // but Mono still needs to run on them :( return true; |