茫茫網海中的冷日 - 對這文章發表回應
茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1673119 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_60D_00027.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

對這文章發表回應

發表限制: 非會員 可以發表

發表者: 冷日 發表時間: 2016/1/23 9:12:07

ConvertTo-SecureString

Convert an encrypted standard string into a secure string, can also convert plain text into a secure string.


Syntax
ConvertTo-SecureString [-String] String
[[-secureKey] SecureString]
[CommonParameters]
ConvertTo-SecureString [-String] String
[-key Byte[]]
[CommonParameters]
ConvertTo-SecureString [-String] String
[[-asPlainText] [-force]]
[CommonParameters]
key
-String SecureString
The string to convert to a secure string
-secureKey SecureString
The encryption key as a secure string,
this is converted to a byte array before being used as the key.
Valid key lengths are 16, 24, and 32 bytes
-key Byte
The encryption key as a byte array.
Valid key lengths are 16, 24, and 32 bytes
-asPlainText
A plain text string to convert to a secure string.
The text is not encrypted so the input is not protected/confidential
To use this option, you must also specify -Force
-force
Set this to confirm that you understand the security risks of using PlainText
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.

If the standard string being converted was encrypted with ConvertFrom-SecureString using a specified key, that same key must be provided as the value of the Key or SecureKey parameter of the ConvertTo-SecureString cmdlet.

To store the data in a file for later use, the secure string can be converted back to an encrypted, standard string using ConvertFrom-SecureString

Examples

Create a secure string from plain text:

PS C:\> $my_secure_password = convertto-securestring "P@ssW0rD!" -asplaintext -force

Create a secure string using the Read-Host cmdlet:

PS C:\> $my_secure_password = read-host -assecurestring

Save an encrypted string to disc:


PS C:\> $my_encrypted_string = convertfrom-securestring $my_secure_password -key (1..16)
PS C:\> $my_encrypted_string > password.txt

Read an encrypted string from disc and convert back to a secure string:

PS C:\> $my_secure_password = convertto-securestring (get-content password.txt) -key (1..16)

“The great strength of the totalitarian state is that it forces those who fear it to imitate it” - Adolf Hitler


原文出處:ConvertTo-SecureString | PowerShell | SS64.com
內容圖示
url email imgsrc image code quote
樣本
bold italic underline linethrough   












 [詳情...]
validation picture

注意事項:
預覽不需輸入認證碼,僅真正發送文章時才會檢查驗證碼。
認證碼有效期10分鐘,若輸入資料超過10分鐘,請您備份內容後,重新整理本頁並貼回您的內容,再輸入驗證碼送出。

選項

Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|