package de.persosim.simulator.protocols.pace;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.spec.InvalidKeySpecException;
import de.persosim.simulator.crypto.DomainParameterSet;
/**
* This interface represents the various mapping functions. They map a given set
* of domain parameters to new domain parameters (according to PICC and PCD
* generated mapping data).
*
* @author slutters
*
*/
public interface Mapping {
/**
* This method performs the whole mapping process.
* It pre-computes input data for the actual mapping process, performs the
* actual mapping of domain parameters and composes a comprehensive result.
*
* @param domainParameterSet the set of domain parameters to be mapped
* @param sNonce the nonce s as generated by the PICC
* @param mappingData the mapping data as received from the PCD
* @return the {@link MappingResult}
*/
public abstract MappingResult performMapping(DomainParameterSet domainParameterSet, byte[] sNonce, byte[] mappingData) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, InvalidKeySpecException;
/**
* This method returns a String describing the meaning of what is expected as mapping data input.
* @return a String describing the meaning of what is expected as mapping data input
*/
public abstract String getMeaningOfMappingData();
/**
* This method returns the name of the mapping.
* @return the name of the mapping
*/
public abstract String getMappingName();
/**
* This method performs the actual mapping of domain parameters.
* Although the signature of parameters is identical to {@link #performMapping(DomainParameterSet, byte[], byte[])}
* this method expects differently encoded parameters and only returns part of the mapping result.
*
* @param domainParametersUnmapped the unmapped domain parameters
* @param sNonce the nonce s as generated by the PICC
* @param mappingData mapping data specific to the selected mapping mechanism
* @return the mapped domain parameters
*/
public abstract DomainParameterSet performMappingOfDomainParameters(DomainParameterSet domainParametersUnmapped, byte[] sNonce, byte[] mappingData);
}