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

com.identityx.auth.impl.keys.PublicApiKey Maven / Gradle / Ivy

Go to download

Client library used for adding authentication to http messages as required by IdentityX Rest Services

There is a newer version: 5.6.0.2
Show newest version
package com.identityx.auth.impl.keys;

import java.security.Key;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;

import com.identityx.auth.def.ITokenKey;

public class PublicApiKey implements ITokenKey {

    private String id;
    private X509Certificate cert;
    private X509Certificate caCert;
    private List intermediateCerts = new ArrayList();
	private String serverCertDN;
	private boolean revocationEnabled = true;
	private boolean ocspEnabled = false;

	
    public PublicApiKey() {}
    
    public PublicApiKey(String id, X509Certificate cert, X509Certificate caCert) {
    	
    	if (cert == null) throw new IllegalArgumentException("cert parameter cannot be null");
    	
    	this.cert = cert;
    	this.caCert = caCert;
    	this.id = id;
    	this.setServerCertDN(cert.getSubjectDN().toString());
    }

    public PublicApiKey(String id, X509Certificate caCert, String serverCertDN) {
    	
    	this.caCert = caCert;
    	this.id = id;
    	this.setServerCertDN(serverCertDN);
    }

    
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
    
	public Key getKey() {
		return cert.getPublicKey();
	}
    
	public byte[] applySignature(byte[] data) {
		
		return null;
    }

    public X509Certificate getCert() {
		return cert;
	}
	public void setCert(X509Certificate cert) {
		this.cert = cert;
	}

	public X509Certificate getCaCert() {
		return caCert;
	}

	public void setCaCert(X509Certificate caCert) {
		this.caCert = caCert;
	}

	public List getIntermediateCerts() {
		return intermediateCerts;
	}

	public String getServerCertDN() {
		return serverCertDN;
	}

	public void setServerCertDN(String serverCertDN) {
		this.serverCertDN = serverCertDN;
	}

	public boolean isRevocationEnabled() {
		return revocationEnabled;
	}

	public void setRevocationEnabled(boolean revocationEnabled) {
		this.revocationEnabled = revocationEnabled;
	}

	public boolean isOcspEnabled() {
		return ocspEnabled;
	}

	public void setOcspEnabled(boolean ocspEnabled) {
		this.ocspEnabled = ocspEnabled;
	}

}
	




© 2015 - 2025 Weber Informatics LLC | Privacy Policy