Function Reference


_Crypt_DestroyKey

Frees the resources used by a key

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

Parameters

$hCryptKey Key to destroy

Return Value

Success: True
Failure: False and sets the @error flag to non-zero
@error: 10 - Destroying key failed

Remarks

Destroys a key previously created by _Crypt_DeriveKey()

Related

_Crypt_DeriveKey

See Also

Search CryptDestroyKey in MSDN Library.

Example

#include <Crypt.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    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($MB_SYSTEMMODAL, "Encrypted data", $sOutput)

    _Crypt_DestroyKey($hKey) ; Destroy the cryptographic key.
EndFunc   ;==>Example