<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--

    Copyright 2018 Scytl Secure Electronic Voting SA

    All rights reserved

    See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package

-->
<Plugins>
    <Phase name="export">
		<!-- import/export tool for SDM must be executed before copying to USB -->
		<Plugin type="cmd" order="1">
			<![CDATA[#SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\copyToUsb.bat #USB_LETTER# #EE_ID# #EE_ALIAS# #SDM_PATH#]]>
		</Plugin>
    </Phase>
	
	<!-- Copy files from USB before constituting the Admin Board -->
    <Phase name="import">
		<Plugin type="cmd" order="1"><![CDATA[#USB_LETTER#\sdm_#EE_ALIAS#\copyFromUsb.bat #EE_ALIAS# #USB_LETTER#\sdm_#EE_ALIAS#]]></Plugin>
	</Phase>

	<!--fileconverter2-->
	<!--2_after_exporting_data_to_sdm  -->
	<!--fileconverter3-->
	<!--3_after_credential_generation  -->	
	<!-- Generate SPF after signing the voting card sets -->
    <Phase name="prepare_vc_generation">
		<Plugin type="cmd" order="1">
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_file_converter\ech-file-converter.jar 
					-action election_event_alias_to_id 
					-election_export_in #SDM_PATH#\sdmConfig\config.json 
					-output #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\election_event_alias_to_id_#EE_ALIAS#.csv 
					-log #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log 
					-privateKey #PRIVATE_KEY#]]>
		</Plugin>
		<Plugin type="cmd" order="2">
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_file_converter\ech-file-converter.jar
					-action rc_config_pn 
					-election_export_in #SDM_PATH#\sdmConfig\config.json 
					-rcConfig #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\resultsCounterConfig_#EE_ALIAS#.json 
					-output #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\resultsCounterConfig_#EE_ALIAS#.json 
					-log #SDM_PATH#\eCH\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log 
					-privateKey #PRIVATE_KEY#]]>
		</Plugin>
		<Plugin type="cmd" order="3"> 
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_file_converter\ech-file-converter.jar
				-action voting_card_alias_ea_code 
				-vca_in #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\voting_card_alias_#EE_ALIAS#.csv
				-election_export_in #SDM_PATH#\sdmConfig\config.json 
				-folder #SDM_PATH#\config\#EE_ID#\ONLINE\printing
				-pattern printingData_ 
				-extendedAuthProperties #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\extendedAuthentication.properties
				-output #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\voting_card_alias_ea_code_#EE_ALIAS#.csv
				-log #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log ]]>
		</Plugin>
		<!--voting_card_alias_to_id-->
        <Plugin type="cmd" order="4">
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_file_converter\ech-file-converter.jar 
					-action voting_card_alias_to_id 
					-vca_in	#SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\voting_card_alias_#EE_ALIAS#.csv
					-election_export_in #SDM_PATH#\sdmConfig\config.json
					-folder #SDM_PATH#\config\#EE_ID#\ONLINE\printing
					-pattern new_printingData_						
					-output #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\election_event_alias_to_id_#EE_ALIAS#.csv 
					-log #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log 
					-privateKey #PRIVATE_KEY#]]>			
		</Plugin>
		<!--spf-->
		<Plugin type="cmd" order="5">
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_spf_generator\ech-spf-file-generator.jar
					-action spf 
					-folder #SDM_PATH#\config\#EE_ID#\ONLINE\printing		
					-pattern printingData_
					-vca2id_in #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\voting_card_alias_to_id_#EE_ALIAS#.csv
					-election_export_in #SDM_PATH#\sdmConfig\config.json
					-rcConfig #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\resultsCounterConfig_#EE_ALIAS#.json
					-output  #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\spf_#EE_ALIAS#.xml
					-log #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log 
					-privateKey #PRIVATE_KEY#]]>			
		</Plugin>					
    </Phase>
	
	<!--:4_after_cleansing-->
	<!-- Generate SIV and SVV and copy files -->
    <Phase name="cleansing">

		<!--svv-->
		<Plugin type="cmd" order="1">
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_file_converter\ech-file-converter.jar 
					-action svv 
					-vca2id_in #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\voting_card_alias_to_id_#EE_ALIAS#.csv
					-folder #SDM_PATH#\config\#EE_ID#\ONLINE\electionInformation\ballots 
					-filename successfulVotes.csv  
					-output #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\svv_#EE_ALIAS#.csv 
					-log #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log 
					-privateKey #PRIVATE_KEY#]]>			
		</Plugin>	
		
		<!--siv-->
		<Plugin type="cmd" order="2">
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_file_converter\ech-file-converter.jar 
					-action siv 
					-vca2id_in #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\voting_card_alias_to_id_#EE_ALIAS#.csv
					-folder #SDM_PATH#\config\#EE_ID#\ONLINE\electionInformation\ballots 
					-filename failedVotes.csv  
					-output #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\siv_#EE_ALIAS#.csv 
					-log #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log 
					-privateKey #PRIVATE_KEY#]]>			
		</Plugin>

    </Phase>

	<!--:5_after_decryption-->
	<!-- Generate SDF and SVV_decryption and copy files -->
    <Phase name="decryption">
	
        <!--sdf-->
		<Plugin type="cmd" order="1">
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_file_converter\ech-file-converter.jar 
					-action sdf 					
					-folder #SDM_PATH#\config\#EE_ID#\ONLINE\electionInformation\ballots 
					-filename decryptedBallots.csv  
					-election_export_in #SDM_PATH#\sdmConfig\config.json
					-ech_0159_in #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\input\eCH-0159.xml
					-ech_0157_in #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\input\eCH-0157.xml
					-rcConfig #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\resultsCounterConfig_#EE_ALIAS#.json
					-output #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\sdf_#EE_ALIAS#.csv 
					-log #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log 
					-privateKey #PRIVATE_KEY#]]>			
		</Plugin>
		
		<!--siv_from_decryption-->
		<Plugin type="cmd" order="2">
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_file_converter\ech-file-converter.jar 
					-action siv_from_decryption 					
					-folder #SDM_PATH#\config\#EE_ID#\ONLINE\electionInformation\ballots 
					-pattern auditableVotes									
					-output #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\siv_decryption_#EE_ALIAS#.csv 
					-log #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log 
					-privateKey #PRIVATE_KEY#]]>			
		</Plugin>
		
		<!-- counting -->
		<Plugin type="cmd" order="3">
			<![CDATA[java -jar #SDM_PATH#\eCH\eCH_counting_tool\ech-results-launcher.jar
				-folder #SDM_PATH#\config\#EE_ID#\ONLINE\electionInformation\ballots 
				-votes_in decryptedBallots.csv
				-failed_votes_in failedVotes.csv
				-auditable_votes_in auditableVotes.csv
				-output #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\eCH-0110_#EE_ALIAS#.xml 
				-ech_0159_in #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\input\eCH-0159.xml
				-ech_0157_in #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\input\eCH-0157.xml
				-rcc_in #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\output\resultsCounterConfig_#EE_ALIAS#.json 
				-log #SDM_PATH#\eCH\electionEvents\#EE_ALIAS#\logs\eCH_file_converter_#EE_ALIAS#.log 
			]]>
		</Plugin>
    </Phase>
    
    <Phase name="decryption_1">
        <Plugin type="java" order="1">com.scytl.security.Verify></Plugin>
    </Phase>
    <Phase name="decryption_2">
        <Plugin type="java" order="1">com.scytl.security.Sign></Plugin>
    </Phase>
</Plugins>
