Class SecureStringExtensions
Extensions for the SecureString class.
Inherited Members
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.dll
Syntax
public static class SecureStringExtensions
Methods
| Edit this page View SourceRead(SecureString)
Converts a SecureString to a string.
Declaration
public static string Read(this SecureString value)
Parameters
Type | Name | Description |
---|---|---|
SecureString | value | The SecureString to convert. |
Returns
Type | Description |
---|---|
string | A managed string. |
Remarks
Using this method is NOT RECOMMENDED, as converting to a string defeats the original purpose of SecureString. It's provided as a simple alternative in cases where the program doesn't rely on maintaining the confidentiality of a specific string during execution.
ReadBytes(SecureString)
Converts a SecureString to an array of byte.
Declaration
public static byte[] ReadBytes(this SecureString value)
Parameters
Type | Name | Description |
---|---|---|
SecureString | value | The SecureString to convert. |
Returns
Type | Description |
---|---|
byte[] | A managed array of byte. |
Remarks
The byte array read corresponds to a UTF-16 string.
ReadChars(SecureString)
Converts a SecureString to an array of char.
Declaration
public static char[] ReadChars(this SecureString value)
Parameters
Type | Name | Description |
---|---|---|
SecureString | value | The SecureString to convert. |
Returns
Type | Description |
---|---|
char[] | A managed array of char. |
ReadInt16(SecureString)
Converts a SecureString to an array of short.
Declaration
public static short[] ReadInt16(this SecureString value)
Parameters
Type | Name | Description |
---|---|---|
SecureString | value | The SecureString to convert. |
Returns
Type | Description |
---|---|
short[] | A managed array of short. |
ToBase64(SecureString)
Converts a SecureString to a Base64 formatted string.
Declaration
public static string ToBase64(this SecureString value)
Parameters
Type | Name | Description |
---|---|---|
SecureString | value | The SecureString to convert. |
Returns
Type | Description |
---|---|
string | A Base64 formatted string. |
Remarks
The byte array read before conversion to Base64 corresponds to a UTF-16 string.