函数参考


_Crypt_DestroyKey

释放密钥使用的资源

#Include <Crypt.au3>
_Crypt_DestroyKey($hCryptKey)

参数

$hCryptKey 要销毁的密钥

返回值

成功: 返回 true
设置 @error 为 0
失败: 返回 -1 并设置 @error:
1 - 销毁密钥失败

注意/说明

销毁由 _Crypt_DeriveKey 创建的密钥

相关

_Crypt_DeriveKey

详情参考

在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.