aboutsummaryrefslogtreecommitdiffstats
path: root/test/ossl_cipher.rb
blob: 6a54dce2ba2067eddc3f9c9096aad4db7e1679dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env ruby

require 'openssl'
include OpenSSL
include Cipher

p des = DES.new(EDE3, CBC) #Des3 CBC mode
p "ENCRYPT"
p des.encrypt("key")#, "iv12345678")
p cipher = des.update("abcdefghijklmnopqrstuvwxyz")
p cipher += des.cipher
p "DECRYPT"
p des.decrypt("key") #, "iv12345678")
p des.update(cipher) + des.cipher