<Instance Aid="A0000000185000000000000052414441" Index="1" ApplicationSpecificParameters="7110A0000000185201050000000040534357" EepromSize="0000" RamSize="0000" InstallToken="" Privilege="00">
<!--If you add another Instance, you should increase his Index number-->
<GSMParameter TextMaxLength="14" MaxNumberOfMenuEntries="01" PriorityLevel="FF" TimerMaxNumber="00" Menus="0000">
<!--You can customize the GSM parameters of this Instance here-->
<SIMR5Parameter MaximumChannels="02">
<!--2 Channel -->
</SIMR5Parameter>
</GSMParameter>
<UICCParameter>
<!--You can customize the UICC parameters of this Instance here-->
<UICCToolkitParameter>
<UICCR6ToolkitParameter MaximumNumberOfServices="00"/>
</UICCToolkitParameter>
<!--You can customize the UICC Access Application parameters of this Instance here-->
<UICCAccessApplicationParameter Index="1">
<UICCR6AccessApplicationParameter AccessDomainParameter="00" AccessDomainData=""/>
</UICCAccessApplicationParameter>
</UICCParameter>
</Instance>
Friday, March 21, 2008
Sunday, March 16, 2008
Multimedia Ready Card
AID : A0 00 00 00 18 43 4D 08 09 0A 0B 0C 00 00 00
Edit : C:\Documents and Settings\$User\GemXploreDeveloper\keyfiles\scws carddefault.keys
aid.security_domain=hex/A0 00 00 00 18 43 4D 08 09 0A 0B 0C 00 00 00
And For MMready1.0 card, you need modify something in your .gdp file to be able to load it in your real card.
Remove the SecurityDomainAid value in gdp file. For example,
Edit : C:\Documents and Settings\$User\GemXploreDeveloper\keyfiles\scws carddefault.keys
aid.security_domain=hex/A0 00 00 00 18 43 4D 08 09 0A 0B 0C 00 00 00
And For MMready1.0 card, you need modify something in your .gdp file to be able to load it in your real card.
Remove the SecurityDomainAid value in gdp file. For example,
- Modify SecurityDomainAid="A0000000185201050000000030534357" to SecurityDomainAid=""
- Modify ApplicationSpecificParameters="7110A0000000185201050000000040534357" to ApplicationSpecificParameters="7110A0000000185201050000000030534357"
Parsing Query in Smart Web Server
SharedByteString name = new SharedByteString();
formParser.parse(this, queryString, stringValueBuffer, name,value);
SharedByteString value= new SharedByteString();
StringValueBuffer stringValueBuffer = new StringValueBuffer((short) 50, (short) 100); //short sizeRAM, short sizeEEPROM
FormParser formParser = new FormParser(true);
ByteString queryString = req.getQueryString();
if (queryString != null) {
}
Display response page in SCWS
HttpCardServletOutputStream
You can call it in following methods :
You can call it in following methods :
- public void doDelete(HttpCardServletRequest req,httpCardServletResponse resp) throws Exception
- public void doGet(HttpCardServletRequest req, HttpCardServletResponse resp)throws Exception
- public void doHead(HttpCardServletRequest req, HttpCardServletResponse resp)throws UserException, Exception
- public void doOptions(HttpCardServletRequest req,HttpCardServletResponse resp) throws Exception
- public void doPost(HttpCardServletRequest req, HttpCardServletResponse resp)throws Exception
- public void doPut(HttpCardServletRequest req, HttpCardServletResponse resp)throws Exception
byte [] hello = {'h','e','l','l','o'};
resp.setStatus(HttpCardServletResponse.SC_OK);
resp.setContentType(stringContainer.getConstantString(HttpStringContainer.TEXT_HTML_KEY));
HttpCardServletOutputStream out = resp.getOutputStream();
resp.setContentLength((short)5);
out.write(hello, (short) 0,(short)5);
Friday, March 14, 2008
Get Input stream content in Smart Card Web Server
HttpCardServletInputStream
You can call it in following methods :
You can call it in following methods :
- public void doDelete(HttpCardServletRequest req,httpCardServletResponse resp) throws Exception
- public void doGet(HttpCardServletRequest req, HttpCardServletResponse resp)throws Exception
- public void doHead(HttpCardServletRequest req, HttpCardServletResponse resp)throws UserException, Exception
- public void doOptions(HttpCardServletRequest req,HttpCardServletResponse resp) throws Exception
- public void doPost(HttpCardServletRequest req, HttpCardServletResponse resp)throws Exception
- public void doPut(HttpCardServletRequest req, HttpCardServletResponse resp)throws Exception
byte data;
byte[] content = JCSystem.makeTransientByteArray((short) req .getContentLength(), JCSystem.CLEAR_ON_RESET);
HttpCardServletInputStream in = req.getInputStream();
try {
for (short i = 0; i < content.length; i++)
{
data = in.read();
content[i] = data;
}
}
catch (EndOfStreamException e) { }
// or
in.read(content,0,content.length);
HttpCardServletContainer
It manages (add and remove) servlet
You can call it http://URL/post
HttpCardServlet servlet
HttpCardServletContainer servletContainer;
static byte[] prefix = { '/', 'p','o','s','t'}
AID server = JCSystem.lookupAID(buffer, offset, aidLen);
servletContainer = (HttpCardServletContainer) JCSystem.getAppletShareableInterfaceObject( server, HttpCardServletContainer.HTTP_CARD_SERVLET_CONTAINER_SERVICE);
servletContainer.add(servlet, new ByteString(prefix));
servletContainer.remove(servlet)
You can call it http://URL/post
Thursday, March 13, 2008
Parsing Form in Smart Web Server
There are 2 class that have been already provided FormHandler and FormParser.
FormHandler
We should implement FormHandler in class. This class has 3 methods, start , form and end.
Start : start of the document parsing, perhaps you can add some codes that initialized the value of variable
Form : Each form value will be known in here. Just compare the form value with the first input parameter.
End : end of the document parsing
for example :
FormHandler
We should implement FormHandler in class. This class has 3 methods, start , form and end.
Start : start of the document parsing, perhaps you can add some codes that initialized the value of variable
Form : Each form value will be known in here. Just compare the form value with the first input parameter.
End : end of the document parsing
for example :
import com.gemplus.javacard.multimedia.framework.ByteString;
import com.gemplus.javacard.multimedia.framework.FormHandler;
public class FormPosting implements FormHandler {
public byte [] username;
public byte [] usermail;
private static final byte[] USERNAME={'u','s','e','r','n','a','m','e'};
private static final byte[] USERMAIL={'u','s','e','r','m','a','i','l'};
public void start() {
username=null;
usermail=null;
}
public void form(ByteString arg0, ByteString arg1) {
if (arg0.compareTo(USERNAME, (short) 0, (short) USERNAME.length) == 0)
{
username = arg1.getBytes();
}
else if (arg0.compareTo(USERMAIL, (short) 0, (short) USERMAIL.length) == 0)
usermail = arg1.getBytes();
}
public void end() {
// TODO Auto-generated method stub
}
}
FormParserSharedByteString name = new SharedByteString();
SharedByteString value= new SharedByteString();
StringValueBuffer stringValueBuffer = new StringValueBuffer((short) 50, (short) 100); //short sizeRAM, short sizeEEPROM
FormParser formParser = new FormParser(true);
// some methods
HttpCardServletRequest req
byte data;
byte[] content = JCSystem.makeTransientByteArray((short) req.getContentLength(), JCSystem.CLEAR_ON_RESET);
stringValueBuffer.reset();
HttpCardServletInputStream in = req.getInputStream();
try {
for (short i = 0; i < content.length; i++) {
data = in.read();
content[i] = data;
} } catch (EndOfStreamException e) { }
// URL encoded
formParser.parse(FormPosting, new ByteString(content), stringValueBuffer, name, value);
Subscribe to:
Posts (Atom)