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

org.openas2.app.cert.ViewCertCommand Maven / Gradle / Ivy

Go to download

Open source implementation of the AS2 standard for signed encrypted and compressed document transfer

There is a newer version: 2.10.1
Show newest version
package org.openas2.app.cert;

import java.security.cert.Certificate;

import org.openas2.OpenAS2Exception;
import org.openas2.cert.AliasedCertificateFactory;
import org.openas2.cmd.CommandResult;

/**
 * view certs by alias
 *
 * @author Don Hillsberry
 */
public class ViewCertCommand extends AliasedCertCommand {
	public String getDefaultDescription() {
		return "View the certificate associated with an alias.";
	}

	public String getDefaultName() {
		return "view";
	}

	public String getDefaultUsage() {
		return "view ";
	}

	protected CommandResult execute(AliasedCertificateFactory certFx,
			Object[] params) throws OpenAS2Exception {
		if (params.length < 1) {
			return new CommandResult(CommandResult.TYPE_INVALID_PARAM_COUNT,
					getUsage());
		}

		synchronized (certFx) {

			String alias = params[0].toString();

			Certificate cert = certFx.getCertificate(alias);

			return new CommandResult(CommandResult.TYPE_OK, cert.toString());

		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy