//
// Server-side OOM tests for filetokens cert store, run in configuration 1
//

// Setup ///////////////////////////////////////////////////////////////////////

<action>
	<actionname>No Test,Opening a CertificateAppInfoManager</actionname>
	<actiontype>initappmanager</actiontype>
	<actionbody></actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Adding client A1</actionname>
	<actiontype>addclient</actiontype>
	<actionbody>
		<name>A1</name>
		<uid>1</uid>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Adding client A2</actionname>
	<actiontype>addclient</actiontype>
	<actionbody>
		<name>A2</name>
		<uid>2</uid>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Adding client A3</actionname>
	<actiontype>addclient</actiontype>
	<actionbody>
		<name>A3</name>
		<uid>3</uid>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Adding client A4</actionname>
	<actiontype>addclient</actiontype>
	<actionbody>
		<name>A4</name>
		<uid>4</uid>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Deleting the CertificateAppInfoManager</actionname>
	<actiontype>deleteappmanager</actiontype>
	<actionbody></actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Import a RSA key rsacertkey1</actionname>
	<actiontype>importkey</actiontype>
	<actionbody>
		<ImportData>rsacertkey1.txt</ImportData>
		<keyusage>AllUsagesButNR</keyusage>
		<keylabel>*IMPORTED* RSA key 1</keylabel>
		<keyaccesstype>Extractable</keyaccesstype>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Opening a writable certificate store manager</actionname>
	<actiontype>init</actiontype>
	<actionbody>
		<mode>write</mode>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Deleting all certs</actionname>
	<actiontype>deletecert</actiontype>
	<actionbody>
		<label>*.*</label>
		<deleteallcerts>1</deleteallcerts>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Deleting the writable certificate store manager</actionname>
	<actiontype>delete</actiontype>
	<actionbody></actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Start server OOM testing</actionname>
	<actiontype>startserveroom</actiontype>
</action>

// Initialisation //////////////////////////////////////////////////////////////

<action>
	<actionname>Opening a writable certificate store manager</actionname>
	<actiontype>init</actiontype>
	<actionbody>
		<mode>write</mode>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

// Add certs ///////////////////////////////////////////////////////////////////

<action>
	<actionname>Add X509 CA certificate CAX1</actionname>
	<actiontype>addcert</actiontype>
	<actionbody>
		<format>X509</format>
		<label>CAX1</label>
		<issuerkey></issuerkey>
		<subjectkey></subjectkey>
		<certstore>0</certstore>
		<certfile>c:\unifiedcertstore2\CAX1.cer</certfile>
		<certowner>CA</certowner>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Add WTLS CA certificate CAW1</actionname>
	<actiontype>addcert</actiontype>
	<actionbody>
		<format>WTLS</format>
		<label>CAW1</label>
		<issuerkey></issuerkey>
		<subjectkey></subjectkey>
		<certstore>0</certstore>
		<certfile>c:\unifiedcertstore2\CAW1.cer</certfile>
		<certowner>CA</certowner>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Add X509 user certificate rsacert1</actionname>
	<actiontype>addcert</actiontype>
	<actionbody>
		<format>X509</format>
		<label>rsacert1</label>
		<issuerkey></issuerkey>
		<subjectkey>4808f03892fe836e78d048bcefcca4a37913d886</subjectkey>
		<certstore>0</certstore>
		<certfile>c:\unifiedcertstore2\rsacert1.cer</certfile>
		<certowner>User</certowner>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

// List certs //////////////////////////////////////////////////////////////////

<action>
	<actionname>List CA certificates</actionname>
	<actiontype>listcert</actiontype>
	<actionbody>
		<filter>
		<ownertype>ca</ownertype>
		</filter>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
		<CCTCertInfo><label>CAX1</label></CCTCertInfo>
		<CCTCertInfo><label>CAW1</label></CCTCertInfo>
	</actionresult>
</action>

<action>
	<actionname>List user certificates</actionname>
	<actiontype>listcert</actiontype>
	<actionbody>
		<filter>
		<ownertype>user</ownertype>
		<keyusagedescription>
			<keyusagescheme>pkcs15</keyusagescheme>
			<keytype>private</keytype>
			<keyusage>AllUsagesButNR</keyusage>
		</keyusagedescription>
		</filter>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
		<CCTCertInfo><label>rsacert1</label></CCTCertInfo>
	</actionresult>
</action>

<action>
	<actionname>List user certificates filtered by key usage</actionname>
	<actiontype>listcert</actiontype>
	<actionbody>
		<filter>
			<ownertype>user</ownertype>
			<keyusagedescription>
				<keyusagescheme>pkcs15</keyusagescheme>
				<keytype>private</keytype>	
				<keyusage>Decrypt</keyusage>
			<keyusagedescription>
		</filter>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
		<CCTCertInfo><label>rsacert1</label></CCTCertInfo>
	</actionresult>
</action>

<action>
	<actionname>List user certificates filtered by key usage</actionname>
	<actiontype>listcert</actiontype>
	<actionbody>
		<filter>
			<ownertype>user</ownertype>
			<keyusagedescription>
				<keyusagescheme>pkcs15</keyusagescheme>
				<keyusage>NonRepudiation</keyusage>
			</keyusagedescription>
		</filter>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>List certificates filtered by Issuer DN</actionname>
	<actiontype>listcert</actiontype>
	<actionbody>
		<filter>
			<ownertype>ca</ownertype>
		</filter>
		<issuerdn>c:\unifiedcertstore2\CAX1.cer</issuerdn>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
		<CCTCertInfo><label>CAX1</label></CCTCertInfo>
	</actionresult>
</action>

<action>
	<actionname>List certificates filtered by Issuer DN</actionname>
	<actiontype>listcert</actiontype>
	<actionbody>
		<filter>
			<ownertype>ca</ownertype>
		</filter>
		<issuerdn>c:\unifiedcertstore2\CAX1.cer</issuerdn>
		<issuerdn>c:\unifiedcertstore2\CAX2.cer</issuerdn>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
		<CCTCertInfo><label>CAX1</label></CCTCertInfo>
	</actionresult>
</action>

<action>
	<actionname>List certificates filtered by Issuer DN</actionname>
	<actiontype>listcert</actiontype>
	<actionbody>
		<filter>
			<ownertype>ca</ownertype>
		</filter>
		<issuerdn>c:\unifiedcertstore2\CAX2.cer</issuerdn>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

// Retrieve certs

<action>
	<actionname>Retrieve CAX1 cert</actionname>
	<actiontype>retrieve</actiontype>
	<actionbody>
		<label>CAX1</label>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Retrieve CAW1 cert</actionname>
	<actiontype>retrieve</actiontype>
	<actionbody>
		<label>CAW1</label>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

// Applications and trust //////////////////////////////////////////////////////

<action>
	<actionname>Set applications to the CAX1 certificate</actionname>
	<actiontype>setapplications</actiontype>
	<actionbody>
		<label>CAX1</label>
		<uid>1 2 3</uid>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Get applications for CAX1</actionname>
	<actiontype>getapplications</actiontype>
	<actionbody>
		<label>CAX1</label>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
		<uid>1 2 3</uid>
	</actionresult>
</action>

<action>
	<actionname>Set the trust for CAX1</actionname>
	<actiontype>settrust</actiontype>
	<actionbody>
		<label>CAX1</label>
		<trust>1</trust>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Get the trust for CAX1</actionname>
	<actiontype>gettrusters</actiontype>
	<actionbody>
		<label>CAX1</label>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
		<trust>1</trust>
	</actionresult>
</action>

// Delete certs ////////////////////////////////////////////////////////////////

<action>
	<actionname>Deleting CAX1 certs</actionname>
	<actiontype>deletecert</actiontype>
	<actionbody>
		<certtype>ca</certtype>
		<label>CAX1</label>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

// Cleanup /////////////////////////////////////////////////////////////////////

<action>
	<actionname>Stop server OOM testing</actionname>
	<actiontype>stopserveroom</actiontype>
</action>

<action>
	<actionname>Deleting all certs</actionname>
	<actiontype>deletecert</actiontype>
	<actionbody>
		<label>*.*</label>
		<deleteallcerts>1</deleteallcerts>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Deleting the writable certificate store manager</actionname>
	<actiontype>delete</actiontype>
	<actionbody></actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Opening a CertificateAppInfoManager</actionname>
	<actiontype>initappmanager</actiontype>
	<actionbody></actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Deleting the client A1</actionname>
	<actiontype>removeclient</actiontype>
	<actionbody>
		<uid>1</uid>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Deleting the client A2</actionname>
	<actiontype>removeclient</actiontype>
	<actionbody>
		<uid>2</uid>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Deleting the client A3</actionname>
	<actiontype>removeclient</actiontype>
	<actionbody>
		<uid>3</uid>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Deleting the client A4</actionname>
	<actiontype>removeclient</actiontype>
	<actionbody>
		<uid>4</uid>
	</actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>No Test,Deleting the CertificateAppInfoManager</actionname>
	<actiontype>deleteappmanager</actiontype>
	<actionbody></actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Sleep 5 seconds</actionname>
	<actiontype>sleep</actiontype>
	<actionbody>
          <seconds>5</seconds>
        </actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>

<action>
	<actionname>Check for server heap error</actionname>
	<actiontype>checkserverheaperror</actiontype>
	<actionbody>
    </actionbody>
	<actionresult>
		<return>KErrNone</return>
	</actionresult>
</action>
