本文整理汇总了VB.NET中System.Security.SecureString类的典型用法代码示例。如果您正苦于以下问题:VB.NET SecureString类的具体用法?VB.NET SecureString怎么用?VB.NET SecureString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SecureString类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Example
' 导入命名空间
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Security
Public Class Example
Public Shared Sub Main()
' Instantiate the secure string.
Dim securePwd As New SecureString()
Dim key As ConsoleKeyInfo
Console.Write("Enter password: ")
Do
key = Console.ReadKey(True)
' Ignore any key out of range
If CInt(key.Key) >= 65 And CInt(key.Key <= 90) Then
' Append the character to the password.
securePwd.AppendChar(key.KeyChar)
Console.Write("*")
End If
' Exit if Enter key is pressed.
Loop While key.Key <> ConsoleKey.Enter
Console.WriteLine()
Try
Process.Start("Notepad.exe", "MyUser", securePwd, "MYDOMAIN")
Catch e As Win32Exception
Console.WriteLine(e.Message)
Finally
securePwd.Dispose()
End Try
End Sub
End Class