| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Security; |
| | 5 | |
|
| | 6 | | namespace Azure.Identity |
| | 7 | | { |
| | 8 | | internal static class StringExtensions |
| | 9 | | { |
| | 10 | | public static SecureString ToSecureString(this string plainString) |
| | 11 | | { |
| 16 | 12 | | if (plainString == null) |
| 0 | 13 | | return null; |
| | 14 | |
|
| 16 | 15 | | SecureString secureString = new SecureString(); |
| 536 | 16 | | foreach (char c in plainString.ToCharArray()) |
| | 17 | | { |
| 252 | 18 | | secureString.AppendChar(c); |
| | 19 | | } |
| 16 | 20 | | return secureString; |
| | 21 | | } |
| | 22 | | } |
| | 23 | | } |