Commit Graph
14 Commits
Author SHA1 Message Date
Daniel Harvey 252cdc5e95 Bulk updates of tests for AssertExtensions (dotnet/corefx#18491)
Bulk update to AssertExtensions.Throws for AOT support. This doesn't disable Assert.Throws.

Commit migrated from https://github.com/dotnet/corefx/commit/b43b4df2e0e2182154bb0f425cb4a61bc1269828
2017-04-18 09:52:02 -07:00
Stephen Toub 50594513ed Re-enable SecureString tests
Commit migrated from https://github.com/dotnet/corefx/commit/2972e05fea2a0815cd5508bb9d1deae42608fceb
2016-11-08 23:41:50 -05:00
Alex Ghiondea 10703f8ca7 Move System.SecureString into System.Runtime.InteropServices and create the appropriate typeforwards.
We are going to take a breaking change and remove the functionality of the SecureStringTo* methods which should now be implemented directly on Marshal.

Once they are avaialable on the Marshal class we can expose them as direct calls from this library.


Commit migrated from https://github.com/dotnet/corefx/commit/edac8aa25cf1bf79f61bcac87b45f06d3b74c456
2016-11-04 23:06:27 -07:00
stephentoub a678e5bf56 Port mini-stress test for SecureString
Commit migrated from https://github.com/dotnet/corefx/commit/dbac7947c03e0a278f4a5bd3623a614a5a364c4f
2016-05-11 15:33:41 -04:00
stephentoub 1c932533b1 Switch SecureString to use CryptProtectMemory
Switch from CryptProtectData to CryptProtectMemory, per feedback and to enable these to be used without a logged-in user, matching the full framework.

Also added some more tests.


Commit migrated from https://github.com/dotnet/corefx/commit/252473667b31743e900332af0cd4a6dce97cb04d
2016-05-09 21:56:04 -04:00
stephentoub 126aee5d87 Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/8fa9f0c611700c72fb253a0da3158658212bfe6a
2016-05-09 10:34:37 -04:00
stephentoub da805e653e Fix SecureString implementation
- Get it to compile again; lots changed since it was removed.
- Fix the package; lots changed since it was removed.
- Fix the Unix implementation to be usable; previous hacky attempts were made to provide deeper security but that significantly impacted usability... now it simply keeps the data in unmanaged memory and ensures it's zeroed out when disposed.
- Added missing methods to SecureStringMarshal
- Improved the tests
- General additional code cleanup


Commit migrated from https://github.com/dotnet/corefx/commit/d144478997b46afcf7a82e6860fce3c29d0dcf62
2016-05-09 09:51:35 -04:00
stephentoub 0071306cde Revert "Remove SecureString usages"
This reverts commit dotnet/corefx@46db5bcbb4.


Commit migrated from https://github.com/dotnet/corefx/commit/8f40e4de684f9a84e5bb959b62499b459e8a7914
2016-05-09 09:51:35 -04:00
Pallavi Taneja 0185f7f683 Remove SecureString usages
Commit migrated from https://github.com/dotnet/corefx/commit/46db5bcbb484baf02f98320287d2fe0bd2e86599
2015-09-29 15:01:25 -07:00
stephentoub 4992aaa978 Fix access to user's home directory on Unix
Today in several places we get a user's home directory by accessing the HOME environment variable.  This is the right place to check first, but in certain cases it may not be set, such as in initialization scripts.

This commit implements a fallback, such that if HOME doesn't have a path, we consult the pw_dir path from a call to getpwuid_r for the current user.

As long as I was adding getpwuid_r to the native shim, I also moved our existing geteuid and getegid imports to the shims.


Commit migrated from https://github.com/dotnet/corefx/commit/5b8f55c8d43a880147478cb7d2191fa607000594
2015-08-19 15:06:32 -04:00
stephentoub d6467ac0af Use RuntimeInformation across corefx for platform detection
This commit deletes our temporary Interop.PlatformDetection.cs mechanism and replaces usage of it with usage of System.Runtime.InteropServices.RuntimeInformation.dll.


Commit migrated from https://github.com/dotnet/corefx/commit/6861b625b391566544be9a60356c8c03b15e5fb5
2015-08-06 10:25:17 -04:00
Stephen Toub 90a55ed934 Fix SecureString exception when buffer re-grows
When characters are removed from a SecureString, the decrypted length can be less than the size of the currently allocated buffer.  When characters are then added again, a new buffer is allocated of size decrypted length + 1, which still might be smaller than the current buffer size.  The code attempts to copy everything from the current buffer to the new buffer, and fails due to the mismatch in lengths.

This commit modifies the SafeBSTRHandle.Copy routine to accept the number of bytes to copy, such that the call sites can specify exactly how much they want copied rather than the function gleaming it from the length of the source.


Commit migrated from https://github.com/dotnet/corefx/commit/d9ec05cf3b30cb3927684a8389aa7f5678acf464
2015-05-14 17:02:34 -04:00
Stephen Toub d153afc3fa Implement SecureString on Unix (w/o encryption)
This commit provides a basic implementation of SecureString that will run on Unix and that will provide the expected inputs/outputs for consumers, but that doesn't do any encryption.  If/when we figure out the right way to do that, we can add it later.   For now, the implementation still stores the data in a native heap (so that the GC doesn't move it around leaving copies behind), zeroes out the data when done with it, uses mlock to attempt to keep the pages from getting swapped out, and uses mprotect to cause seg faults when attempting to access the data while at rest.


Commit migrated from https://github.com/dotnet/corefx/commit/2ba8de9b215b835463a8c402996e54044be6f650
2015-04-13 16:14:03 -04:00
dotnet-bot 45f4ce08b1 Add System.Security.SecureString library
Initial commit for System.Security.SecureString src and tests.
SecureString provides a mechanism to represent a text that should be kept confidential.
The text is encrypted for privacy when used, and is deleted from the computer memory
when no longer needed.


Commit migrated from https://github.com/dotnet/corefx/commit/aaaa4da5a51eaacdfd8897c490f3f843149010e5
2015-04-09 12:31:52 -07:00