package generated.javacard.mondex.purse;

import javacard.framework.Util;
import javacardx.crypto.Cipher;

public abstract class EncData implements Codeable, PlainData {

	public byte[] encrypted;
	public short plainlength;
	public short enclength;
	public byte plainDataType;

	protected static byte[] tmparray;
	protected Cipher c;

	public boolean isEncDataSymm() {
		return false;
	}

	public boolean isEncDataAsymm() {
		return false;
	}

	public void copy(EncData o) {
		enclength = o.enclength;
		plainlength = o.plainlength;
		plainDataType = o.plainDataType;
		Arrays.copy(o.encrypted, encrypted);
	}

	public boolean equals(Codeable other) {
		if (getCode() != other.getCode())
			return false;
		EncData o = (EncData) other;
		if (enclength != o.enclength || plainlength != o.plainlength
				|| plainDataType != o.plainDataType)
			return false;
		return Util.arrayCompare(encrypted, (short) 0,
				((EncData) other).encrypted, (short) 0, enclength) == 0;
	}
}