Method: Cipher::EncryptFile
EncryptFile(PlainText, CipherText)
Given the pathname of a file, the
EncryptFile method will encrypt the file, and write the
resulting cipher text to the location specified in the
CipherText argument. This location
may be identical to that given in the
PlainText argument, in which case the file will be
encrypted in-place, with the cipher text version overwritting the original plain text.
PlainText
The
PlainText argument is the full pathname of the file to encrypt.
CipherText
The
CipherText argument is the full pathname of the file to which the cipher text should be written.
Example:
If WScript.Arguments.Count <> 3 Then
WScript.Echo "usage: encrypt_file.vbs keyfile plaintext ciphertext"
WScript.Quit 1
End If
Set objKey = WScript.CreateObject("dgRijndael.Key")
objKey.ReadKeyFile WScript.Arguments(0)
Set objCipher = WScript.CreateObject("dgRijndael.Cipher")
objCipher.SetKey objKey
objCipher.EncryptFile WScript.Arguments(1), WScript.Arguments(2)
Set objCipher = Nothing
Set objKey = Nothing
WScript.Echo "the file was encrypted"
WScript.Quit 0