/**
* Copyright (c) 2006 by Know-Center, Graz, Austria
*
* This software is the confidential and proprietary information of Know-Center,
* Graz, Austria. You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement you entered
* into with Know-Center.
*
* KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
* THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
* NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
* LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES.
*
* $Id: DummyLDAPAPI.java,v 1.2 2006/08/25 17:09:41 wprinz Exp $
*/
package at.knowcenter.wag.egov.egiz.sig;
import java.io.File;
import java.io.FileInputStream;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
import at.knowcenter.wag.egov.egiz.ldap.api.LDAPAPIException;
import at.knowcenter.wag.egov.egiz.ldap.client.LDAPIssuerNameFilter;
/**
* This is just a dummy implementation until the real Egiz LDAP API is
* implemented.
*
* @author wprinz
* @author modified by Thomas Knall
* @deprecated Use {@link at.knowcenter.wag.egov.egiz.ldap.api.LDAPAPIFactory#createLDAPAPI()} instead.
*/
public class DummyLDAPAPI implements LDAPAPI
{
String url_ = null;
public DummyLDAPAPI(String url)
{
this.url_ = url;
}
/* (non-Javadoc)
* @see at.knowcenter.wag.egov.egiz.sig.LDAPAPI#getURL(String)
*/
public String getURL(String issuer)
{
return this.url_;
}
/* (non-Javadoc)
* @see at.knowcenter.wag.egov.egiz.sig.LDAPAPI#loadCertificateFromLDAP(java.lang.String, java.lang.String)
*/
public byte[] loadBase64CertificateFromLDAP(String serial_number, String issuer)
{
//System.out.println("LDAP: serial_number = " + serial_number);
//System.out.println("LDAP: issuer = " + issuer);
byte[] data = null;
if (serial_number.equals("153868") && issuer.equals("CN=a-sign-TEST-Premium-Sig-01,OU=a-sign-TEST-Premium-Sig-01,O=A-Trust Ges. f. Sicherheitssysteme im elektr. Datenverkehr GmbH,C=AT"))
{
try
{
File test_file = new File(SettingsReader.CERT_PATH + File.separator + "ldap_test_cert.der");
data = new byte[(int) test_file.length()];
FileInputStream fis = new FileInputStream(test_file);
fis.read(data);
fis.close();
}
catch (Exception e)
{
e.printStackTrace();
data = null;
}
}
return data;
}
public void setIssuerNameFilter(LDAPIssuerNameFilter filter) throws LDAPAPIException {
}
}