/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.35
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package be.portugal.eid;

/******************************************************************************//**
  * Class that represents one OCSP Response
  *********************************************************************************/
public class PTEID_OcspResponse extends PTEID_Object {
  private long swigCPtr;

  protected PTEID_OcspResponse(long cPtr, boolean cMemoryOwn) {
    super(pteidlibJava_WrapperJNI.SWIGPTEID_OcspResponseUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  protected static long getCPtr(PTEID_OcspResponse obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      pteidlibJava_WrapperJNI.delete_PTEID_OcspResponse(swigCPtr);
    }
    swigCPtr = 0;
    super.delete();
  }

	/**
	  * Create an OcspResponse object from the URI only and CertID
	  * This OCSP Response is not link to any certificate so some methods could not be used.
	  * These methods throw a PTEID_ExBadUsage() exception
	  */
  public PTEID_OcspResponse(String uri, PTEID_HashAlgo hashAlgorithm, PTEID_ByteArray issuerNameHash, PTEID_ByteArray issuerKeyHash, PTEID_ByteArray serialNumber) {
    this(pteidlibJava_WrapperJNI.new_PTEID_OcspResponse(uri, hashAlgorithm.swigValue(), PTEID_ByteArray.getCPtr(issuerNameHash), issuerNameHash, PTEID_ByteArray.getCPtr(issuerKeyHash), issuerKeyHash, PTEID_ByteArray.getCPtr(serialNumber), serialNumber), true);
  }

	/** Get the uri of the responder */
  public String getUri() throws java.lang.Exception {
    return pteidlibJava_WrapperJNI.PTEID_OcspResponse_getUri(swigCPtr, this);
  }

	/**
	  * Get the response
	  */
  public PTEID_CertifStatus getResponse(PTEID_ByteArray response) throws java.lang.Exception {
    return PTEID_CertifStatus.swigToEnum(pteidlibJava_WrapperJNI.PTEID_OcspResponse_getResponse(swigCPtr, this, PTEID_ByteArray.getCPtr(response), response));
  }

}
