All Downloads are FREE. Search and download functionalities are using the official Maven repository.

es.gob.afirma.standalone.plugins.SignOperation Maven / Gradle / Ivy

The newest version!
package es.gob.afirma.standalone.plugins;

import java.util.Map;
import java.util.Properties;

public class SignOperation {

	private Operation cryptoOperation;
	private byte[] data;
	private String format;
	private String algorithm;
	private Properties extraParams;
	private Map anotherParams;

	public Operation getCryptoOperation() {
		return this.cryptoOperation;
	}
	public void setCryptoOperation(final Operation cryptoOperation) {
		this.cryptoOperation = cryptoOperation;
	}
	public byte[] getData() {
		return this.data;
	}
	public void setData(final byte[] data) {
		this.data = data;
	}
	public String getFormat() {
		return this.format;
	}
	public void setFormat(final String format) {
		this.format = format;
	}
	public String getAlgorithm() {
		return this.algorithm;
	}
	public void setAlgorithm(final String algorithm) {
		this.algorithm = algorithm;
	}
	public Properties getExtraParams() {
		return this.extraParams != null ? (Properties) this.extraParams.clone() : null;
	}
	public void setExtraParams(final Properties extraParams) {
		this.extraParams = extraParams != null ? (Properties) extraParams.clone() : null;
	}
	public Map getAnotherParams() {
		return this.anotherParams;
	}
	public void setAnotherParams(final Map anotherParams) {
		this.anotherParams = anotherParams;
	}


	public enum Operation {
		/** Operación de firma. */
		SIGN,

		/** Operación de cofirma. */
		COSIGN,

		/** Operación de contrafirma. */
		COUNTERSIGN;

		/** Obtiene el tipo de operación de firma a partir de su nombre, o null
		 * si el nombre no corresponde a ninguna operación conocida.
		 * @param opName Nombre de la operación de firma.
		 * @return Operación de firma. */
		public static Operation getOperation(final String opName) {
			if ("SIGN".equalsIgnoreCase(opName)) { //$NON-NLS-1$
				return SIGN;
			}
			if ("COSIGN".equalsIgnoreCase(opName)) { //$NON-NLS-1$
				return COSIGN;
			}
			if ("COUNTERSIGN".equalsIgnoreCase(opName)) { //$NON-NLS-1$
				return COUNTERSIGN;
			}
			return null;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy