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

com.safelayer.rap.impl.model.issuance.InternalState Maven / Gradle / Ivy

Go to download

The PKI Connector RESTAPI is a library that helps developing new PKI Connectors for TrustedX

The newest version!
package com.safelayer.rap.impl.model.issuance;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.security.cert.X509Certificate;
import java.util.HashMap;

import com.safelayer.rap.api.model.issuance.IssuancePutInformationRequest;

@SuppressWarnings("serial")
public class InternalState implements Serializable {

	private IssuancePutInformationRequest informationRequest;
	private HashMap data = new HashMap();
		
	public static class KeyData implements Serializable {

		private ProofOfPossessionValue pop;
		private X509Certificate cert;
		private byte[] certificationRequestInfo;
		
		public KeyData(ProofOfPossessionValue pop, byte[] certificationRequestInfo) {
			this.pop = pop;
			this.certificationRequestInfo = certificationRequestInfo;
		}
		
		public ProofOfPossessionValue getPop() {
			return pop;
		}

		public X509Certificate getCert() {
			return cert;
		}
		
		public byte[] getCertificationRequestInfo() {
			return certificationRequestInfo;
		}

		public void setCert(X509Certificate cert) {
			this.cert = cert;
		}
		
	}
		
	public InternalState(IssuancePutInformationRequest informationRequest) {
		this.informationRequest = informationRequest;		
	}
	
	public IssuancePutInformationRequest getInformationRequest() {
		return informationRequest;
	}

	public HashMap getData() {
		return data;
	}

	public static InternalState fromBytes(byte[] data) throws Exception {
		ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
		Object o = ois.readObject();
		ois.close();
		return (InternalState)o;
	}

	public static byte[] toBytes(InternalState o) throws Exception {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		ObjectOutputStream oos = new ObjectOutputStream(baos);
		oos.writeObject(o);
		oos.close();
		return baos.toByteArray();
	}
	
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy