4
* A convenience class that automatically places the IV
5
* at the beginning of the encrypted stream, so it doesn't have to
6
* be handled explicitely.
7
* Copyright (c) 2007 Henri Torgemane
9
* See LICENSE.txt for full license information.
11
package com.hurlant.crypto.symmetric
13
import flash.utils.ByteArray;
14
import com.hurlant.util.Memory;
16
public class SimpleIVMode implements IMode, ICipher
18
protected var mode:IVMode;
19
protected var cipher:ICipher;
21
public function SimpleIVMode(mode:IVMode) {
23
cipher = mode as ICipher;
26
public function getBlockSize():uint {
27
return mode.getBlockSize();
30
public function dispose():void {
37
public function encrypt(src:ByteArray):void {
39
var tmp:ByteArray = new ByteArray;
40
tmp.writeBytes(mode.IV);
46
public function decrypt(src:ByteArray):void {
47
var tmp:ByteArray = new ByteArray;
48
tmp.writeBytes(src, 0, getBlockSize());
51
tmp.writeBytes(src, getBlockSize());
56
public function toString():String {
57
return "simple-"+cipher.toString();
b'\\ No newline at end of file'