mscorlib(4.0.0.0) API with additions
System.Security.SecureString Class Reference

Represents text that should be kept confidential, such as by deleting it from computer memory when no longer needed. This class cannot be inherited. More...

Inheritance diagram for System.Security.SecureString:
[legend]
Collaboration diagram for System.Security.SecureString:
[legend]

Public Member Functions

 SecureString ()
 Initializes a new instance of the T:System.Security.SecureString class. More...
 
unsafe SecureString (char *value, int length)
 Initializes a new instance of the T:System.Security.SecureString class from a subarray of T:System.Char objects. This constructor is not CLS-compliant. The CLS-compliant alternative is M:System.Security.SecureString.::ctor. More...
 
void AppendChar (char c)
 Appends a character to the end of the current secure string. More...
 
void Clear ()
 Deletes the value of the current secure string. More...
 
SecureString Copy ()
 Creates a copy of the current secure string. More...
 
void Dispose ()
 Releases all resources used by the current T:System.Security.SecureString object. More...
 
unsafe void InsertAt (int index, char c)
 Inserts a character in this secure string at the specified index position. More...
 
bool IsReadOnly ()
 Indicates whether this secure string is marked read-only. More...
 
void MakeReadOnly ()
 Makes the text value of this secure string read-only. More...
 
unsafe void RemoveAt (int index)
 Removes the character at the specified index position from this secure string. More...
 
void SetAt (int index, char c)
 Replaces the existing character at the specified index position with another character. More...
 

Properties

int Length [get]
 Gets the number of characters in the current secure string. More...
 

Detailed Description

Represents text that should be kept confidential, such as by deleting it from computer memory when no longer needed. This class cannot be inherited.

Definition at line 11 of file SecureString.cs.

Constructor & Destructor Documentation

◆ SecureString() [1/2]

System.Security.SecureString.SecureString ( )

Initializes a new instance of the T:System.Security.SecureString class.

Exceptions
T:System.Security.Cryptography.CryptographicExceptionAn error occurred while protecting or unprotecting the value of this instance.
T:System.NotSupportedExceptionThis operation is not supported on this platform.

Definition at line 87 of file SecureString.cs.

◆ SecureString() [2/2]

unsafe System.Security.SecureString.SecureString ( char *  value,
int  length 
)

Initializes a new instance of the T:System.Security.SecureString class from a subarray of T:System.Char objects. This constructor is not CLS-compliant. The CLS-compliant alternative is M:System.Security.SecureString.::ctor.

Parameters
valueA pointer to an array of T:System.Char objects.
lengthThe number of elements of value to include in the new instance.
Exceptions
T:System.ArgumentNullExceptionvalue is null.
T:System.ArgumentOutOfRangeExceptionlength is less than zero or greater than 65,536.
T:System.Security.Cryptography.CryptographicExceptionAn error occurred while protecting or unprotecting the value of this secure string.
T:System.NotSupportedExceptionThis operation is not supported on this platform.

Definition at line 134 of file SecureString.cs.

Member Function Documentation

◆ AppendChar()

void System.Security.SecureString.AppendChar ( char  c)

Appends a character to the end of the current secure string.

Parameters
cA character to append to this secure string.
Exceptions
T:System.ObjectDisposedExceptionThis secure string has already been disposed.
T:System.InvalidOperationExceptionThis secure string is read-only.
T:System.ArgumentOutOfRangeExceptionPerforming this operation would make the length of this secure string greater than 65,536 characters.
T:System.Security.Cryptography.CryptographicExceptionAn error occurred while protecting or unprotecting the value of this secure string.

Definition at line 160 of file SecureString.cs.

◆ Clear()

void System.Security.SecureString.Clear ( )

Deletes the value of the current secure string.

Exceptions
T:System.ObjectDisposedExceptionThis secure string has already been disposed.
T:System.InvalidOperationExceptionThis secure string is read-only.

Definition at line 188 of file SecureString.cs.

◆ Copy()

SecureString System.Security.SecureString.Copy ( )

Creates a copy of the current secure string.

Returns
A duplicate of this secure string.
Exceptions
T:System.ObjectDisposedExceptionThis secure string has already been disposed.
T:System.Security.Cryptography.CryptographicExceptionAn error occurred while protecting or unprotecting the value of this secure string.

Definition at line 203 of file SecureString.cs.

◆ Dispose()

void System.Security.SecureString.Dispose ( )

Releases all resources used by the current T:System.Security.SecureString object.

Implements System.IDisposable.

Definition at line 212 of file SecureString.cs.

◆ InsertAt()

unsafe void System.Security.SecureString.InsertAt ( int  index,
char  c 
)

Inserts a character in this secure string at the specified index position.

Parameters
indexThe index position where parameter c is inserted.
cThe character to insert.
Exceptions
T:System.ObjectDisposedExceptionThis secure string has already been disposed.
T:System.InvalidOperationExceptionThis secure string is read-only.
T:System.ArgumentOutOfRangeExceptionindex is less than zero, or greater than the length of this secure string.-or-Performing this operation would make the length of this secure string greater than 65,536 characters.
T:System.Security.Cryptography.CryptographicExceptionAn error occurred while protecting or unprotecting the value of this secure string.

Definition at line 232 of file SecureString.cs.

◆ IsReadOnly()

bool System.Security.SecureString.IsReadOnly ( )

Indicates whether this secure string is marked read-only.

Returns
true if this secure string is marked read-only; otherwise, false.
Exceptions
T:System.ObjectDisposedExceptionThis secure string has already been disposed.

Definition at line 276 of file SecureString.cs.

◆ MakeReadOnly()

void System.Security.SecureString.MakeReadOnly ( )

Makes the text value of this secure string read-only.

Exceptions
T:System.ObjectDisposedExceptionThis secure string has already been disposed.

Definition at line 286 of file SecureString.cs.

◆ RemoveAt()

unsafe void System.Security.SecureString.RemoveAt ( int  index)

Removes the character at the specified index position from this secure string.

Parameters
indexThe index position of a character in this secure string.
Exceptions
T:System.ObjectDisposedExceptionThis secure string has already been disposed.
T:System.InvalidOperationExceptionThis secure string is read-only.
T:System.ArgumentOutOfRangeExceptionindex is less than zero, or greater than or equal to the length of this secure string.
T:System.Security.Cryptography.CryptographicExceptionAn error occurred while protecting or unprotecting the value of this secure string.

Definition at line 302 of file SecureString.cs.

◆ SetAt()

void System.Security.SecureString.SetAt ( int  index,
char  c 
)

Replaces the existing character at the specified index position with another character.

Parameters
indexThe index position of an existing character in this secure string
cA character that replaces the existing character.
Exceptions
T:System.ObjectDisposedExceptionThis secure string has already been disposed.
T:System.InvalidOperationExceptionThis secure string is read-only.
T:System.ArgumentOutOfRangeExceptionindex is less than zero, or greater than or equal to the length of this secure string.
T:System.Security.Cryptography.CryptographicExceptionAn error occurred while protecting or unprotecting the value of this secure string.

Definition at line 349 of file SecureString.cs.

Property Documentation

◆ Length

int System.Security.SecureString.Length
get

Gets the number of characters in the current secure string.

Returns
The number of T:System.Char objects in this secure string.
Exceptions
T:System.ObjectDisposedExceptionThis secure string has already been disposed.

Definition at line 34 of file SecureString.cs.


The documentation for this class was generated from the following file: