forked from Azure/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Azure#44 from huangpf/crp2
Crp2
- Loading branch information
Showing
16 changed files
with
105 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 1 addition & 19 deletions
20
src/Common/Commands.Common/Properties/Resources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Security; | ||
|
||
namespace Microsoft.WindowsAzure.Commands.Common | ||
{ | ||
/// <summary> | ||
/// Extends SecureString and string to convert from one to the other | ||
/// </summary> | ||
public static class SecureStringExtensions | ||
{ | ||
|
||
/// <summary> | ||
/// Converts a string into a secure string. | ||
/// </summary> | ||
/// <param name="value">the string to be converted.</param> | ||
/// <returns>The secure string converted from the input string </returns> | ||
public static SecureString ConvertToSecureString(this string value) | ||
{ | ||
if (value == null) | ||
{ | ||
throw new ArgumentNullException("value"); | ||
} | ||
|
||
unsafe | ||
{ | ||
fixed (char* chars = value) | ||
{ | ||
SecureString secureString = new SecureString(chars, value.Length); | ||
secureString.MakeReadOnly(); | ||
return secureString; | ||
} | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Converts the secure string to a string. | ||
/// </summary> | ||
/// <param name="secureString">the secure string to be converted.</param> | ||
/// <returns>The string converted from a secure string </returns> | ||
public static string ConvertToString(this SecureString secureString) | ||
{ | ||
if (secureString == null) | ||
{ | ||
throw new ArgumentNullException("secureString"); | ||
} | ||
|
||
IntPtr stringPointer = IntPtr.Zero; | ||
try | ||
{ | ||
stringPointer = Marshal.SecureStringToBSTR(secureString); | ||
return Marshal.PtrToStringBSTR(stringPointer); | ||
} | ||
finally | ||
{ | ||
Marshal.ZeroFreeBSTR(stringPointer); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
src/ResourceManager/Compute/Commands.Compute/Common/SecureStringExtension.cs
This file was deleted.
Oops, something went wrong.
101 changes: 0 additions & 101 deletions
101
src/ResourceManager/Compute/Commands.Compute/Common/TagsConversionHelper.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.