In 1998 when Schlumberger Smart Card Systems (now Axalto, Inc) introduced JavaCards, application development for smart cards saw a revolutionary change. Being able to program in high level object oriented language not only speeded up the application development but bring interoperability of applications with other card manufacturers. JavaCards are/were definitely a mile stone in SmartCard evolution.
Though JavaCards brought Java to SmartCards application model remained essentially the same i.e based on IS07816-4 commuication concepts (commonly known as APDUs). A developer of on-card and off-card applications need to be an expert of this constrained APDU protocol.
With .NET SmartCard we introduce a new Smart Card running a CLR, pure subset of ECMA framework libraries and state-of-art SmartCard operating system. This time we did not want to invent something new as far as appication frameworks are concerned as it not only make developers learn new apis but does not fit in existing off-card frameworks.
Here I am describing our communication framework and will blog other exciting feaures in coming days.
Application model for .NET SmartCard applications (or better call them services) is subset of .NET Remoting framework with transport channel based on IS07816-4 protocol for smart cards. The framework hides all the details of underlying transport protocol from developer. Lets look at the snippet of simple on-card application:
public class MySmartService : MarshalByRefObject{
public static void Main(){
APDUServerChannel channel = new APDUServerChannel(0x12);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(MySmartService), “MyService.rem“, WellKnownObjectMode.Singleton);
}
public string SayHello(string name){
return "Hello " + name;
}
}
As you can see, other than Transport channel there is no difference between on-card & off-card remoting services.
Real benefit of this application model is encashed when we write client application where again only transport channel needs to be changed.
public class MyClient{
public static void Main(){
APUDClientChannel channel = new APDUClientChannel();
ChannelServices.RegisterChannel(channel);
MySmartService serv = (MySmartService)Activator.GetObject(typeof(MySmartService), "apdu:\\selfDiscover:na:0x12\MyService.rem");
Console.WriteLine(serv.SayHello("Mr. Bill gates"));
}
}
On-card Remoting framework is extensible also as you can write custom sinks.
Sometime back I also wrote a version of SoapChannel (ala WSE2.0 Custom transport channels) which provide seamless connectivity to .NET SmartCard Services from WebServices based on WSE2.0 application framework. Will do a writeup on this later.