<?xml version="1.0" encoding="UTF-8"?>
<test id="crypto/signtext/2" class="A" scope="crypto" testtype="application" type="manual" source="cyrp#5.1.2" device="both">
  <assertion>When the Operator is presented with the text to sign after a call to the WML Script Library function Crypto.signText, the Operator may choose to cancel the operation without the text being signed the function should then return the string "error:userCancel".
</assertion>
  <specnote>New for June 2000.  Here the User should click on the "link", and then cancel the signing operation when prompted.  Only cancelling the signing operation will cause the test to pass.</specnote>
  <results>
    <result>
      <name>test</name>
      <value>pass</value>
    </result>
  </results>
  <method>
    <![CDATA[<card newcontext="true" id="main">
<p>
The script referenced by this &nbsp; <a href="<script1>#main('card1')">link</a> &nbsp; uses the Crypto.signText function to sign a block of text, you should cancel the operation for the test to succeed.
</p>
</card>]]>
  </method>
  <cards>
    <card id="1">
      <![CDATA[<card id="card1">
<onevent type="onenterforward">
<go href="<resulturl>">
<postfield name="test" value="$test"/>
<sessionvars>
</go>
</onevent>
<auto_failed>
</card>
]]>
    </card>
  </cards>
  <scripts>
    <script id="1">
      <![CDATA[extern function main(next)
{

	var texttosign = "This is a test";
	var options    = 0;
	var keytypeid  = 0;
	var keyid      = "";
	var test       = "fail";

	var retval = Crypto.signText (texttosign,
	                              options,
	                              keytypeid,
	                              keyid);

	if (retval == "error:userCancel")
        {

	   test = "pass";

        }

	WMLBrowser.setVar ('test', test);
	WMLBrowser.go ('#' + next);

}
]]>
    </script>
  </scripts>
</test>

