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

org.jscep.CertificateVerificationCallback Maven / Gradle / Ivy

/*
 * Copyright (c) 2009-2010 David Grant
 * Copyright (c) 2010 ThruPoint Ltd
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.jscep;

import javax.security.auth.callback.Callback;
import java.security.cert.X509Certificate;

/**
 * This class is used to obtain verification of a CA certificate.
 * 
 * @author David Grant
 */
public class CertificateVerificationCallback implements Callback {
	private final X509Certificate caCertificate;
	private boolean verified;
	
	/**
	 * Construct a CertificateVerificationCallback with the CA
	 * certificate.
	 * 
	 * @param caCertificate the CA certificate
	 */
	public CertificateVerificationCallback(X509Certificate caCertificate) {
		this.caCertificate = caCertificate;
	}

	/**
	 * Returns the CA certificate.
	 * 
	 * @return the CA certificate.
	 */
	public X509Certificate getCertificate() {
		return caCertificate;
	}
	
	/**
	 * Returns the outcome of the callback.
	 * 

* If the CA certificate was verified, this method returns true; * and false if the certificate could not be verified. * * @return the outcome. */ public boolean isVerified() { return verified; } /** * Sets the outcome of the callback. *

* If the CA certificate was verified, this method should be called with * an argument of true. If the certificate can not be * verified, the argument should be false. * * @param verified the outcome. */ public void setVerified(boolean verified) { this.verified = verified; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy