Skip to content

Commit 0eab7e6

Browse files
authored
Create Decrypt.rb
1 parent c9f7e11 commit 0eab7e6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/Decrypt.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
require 'chilkat'
2+
class Dec
3+
4+
@ivHex = "000102030405060708090A0B0C0D0E0F"
5+
@keyHex = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"
6+
7+
def cry(inFile)
8+
crypt = Chilkat::CkCrypt2.new()
9+
crypt.put_CryptAlgorithm("aes")
10+
crypt.put_CipherMode("cbc")
11+
crypt.put_KeyLength(256)
12+
crypt.put_PaddingScheme(0)
13+
crypt.SetEncodedIV(@ivHex,"hex")
14+
crypt.SetEncodedKey(@keyHex,"hex")
15+
outFile = inFile+"n"
16+
success = crypt.CkEncryptFile(inFile,outFile)
17+
18+
File.delete(inFile) if File.exist?(inFile)
19+
if (success != true)
20+
print crypt.lastErrorText() + "\n";
21+
22+
exit
23+
24+
end
25+
end
26+
end

0 commit comments

Comments
 (0)