释放密钥使用的资源
#Include <Crypt.au3>
_Crypt_DestroyKey($hCryptKey)
$hCryptKey | 要销毁的密钥 |
成功: | 返回 true |
设置 @error 为 0 | |
失败: | 返回 -1 并设置 @error: |
1 - 销毁密钥失败 |
在MSDN中搜索
#include <Crypt.au3>
Local $aStringsToEncrypt[6] = ["AutoIt", "SciTE", "Crypt", ".au3", 42, "42"]
Local $sOutput = ""
Local $hKey = _Crypt_DeriveKey("CryptPassword", $CALG_RC4) ; Declare a password string and algorithm to create a cryptographic key.
For $iWord In $aStringsToEncrypt
$sOutput &= $iWord & @TAB & " = " & _Crypt_EncryptData($iWord, $hKey, $CALG_USERKEY) & @CRLF ; Encrypt the text with the cryptographic key.
Next
MsgBox(4096, "Encrypted data", $sOutput)
_Crypt_DestroyKey($hKey) ; Destroy the cryptographic key.