Bu sayfanın seçili sürümü ile mevcut sürümü arasındaki farkları gösterir.
en:esya:smartcard:konfig [2013/09/12 07:50] Dindar Öz oluşturuldu |
en:esya:smartcard:konfig [2013/09/12 08:13] (mevcut) Dindar Öz |
||
---|---|---|---|
Satır 1: | Satır 1: | ||
===== Configuration ===== | ===== Configuration ===== | ||
- | Akıllı kart kütüphanesinde konfigürasyon aracılığı ile | + | ESYA Smartcard API uses configuration file in order to |
- | - Yeni kart tipi tanımlanabilir | + | - define a new card type |
- | - Kart driver değiştirilebilir | + | - specify a card driver |
- | - Tanımlı kart tiplerine, kartı tanımaya yarayan yeni ATR değerleri eklenebilir.Böylece sistemde yeni bir kart(marka/versiyon) kullanılabilir. | + | - add new ATR values to existing card types, which are used to detect card. |
- | Bu işlemler API ile birlikte dağıtılan ''smartcard-config.xml'' adındaki konfigürasyon dosyası ile yapılmaktadır. Bu dosyada ilk değerler vardır. Bu değerler API içinde gömülü olduğu için, yeni bir ayar yapılmayacaksa bu dosyayı kullanmaya gerek yoktur. | + | The configuration file is ''smartcard-config.xml'' and distributed within the API package. Initial values are set in this file and these initial values are also embedded in the API source. If no new card configuration exists, then there is no need to use the configuration file. |
- | Eğer konfigürasyonda değişiklik yapılırsa, konfigürasyon dosyası ''SmartCardConfigParser'' aracılığı ile okunmalı ve ''CardType'' sınıfı, bu konfigürasyondan haberdar edilmelidir. | + | If the configuration file is modified, then it must be read via ''SmartCardConfigParser'' and the class ''CardType'' must be configured accordingly. |
- | Örnek Kod: Çalışma dizini içindeki ''smartcard-config.xml'' ile akıllı kart konfigürasyonu yapma. | + | Sample Code: Using the configuration file ''smartcard-config.xml'' . |
<sxh java> | <sxh java> | ||
List<CardTypeConfig> cards = new SmartCardConfigParser().readConfig(); | List<CardTypeConfig> cards = new SmartCardConfigParser().readConfig(); | ||
Satır 16: | Satır 16: | ||
</sxh> | </sxh> | ||
- | Eğer konfigürasyon dosyası farklı bir isimde ya da başka bir lokasyonda ise ''SmartCardConfigParser'' sınıfının InputStream nesnesi alan metodu da kullanılabilir: | + | If the configuration file has different name or it is at some other location then the method which is taking ''InputStream'' of ''SmartCardConfigParser'' can be used. |
<sxh java> | <sxh java> | ||
List<CardTypeConfig> cards = new SmartCardConfigParser().readConfig(inputStream); | List<CardTypeConfig> cards = new SmartCardConfigParser().readConfig(inputStream); | ||
Satır 22: | Satır 23: | ||
</sxh> | </sxh> | ||
- | ==== Konfigürasyon ile Kart Tipi Tanımlama ==== | + | ==== Defining a New Card Type ==== |
- | Aşağıda örnek bir akıllı kart tanımlaması görülmektedir: | + | A sample card definition is as follows: |
<sxh xml> | <sxh xml> | ||
<card-type name="AKIS"> | <card-type name="AKIS"> | ||
Satır 34: | Satır 35: | ||
</sxh> | </sxh> | ||
- | ''<card-type>'' elemanı ile kart tipi tanımlanır. ''<lib>'' elemanı işletim sistemine özel driver belirtmek için kullanılır. | + | ''<card-type>'' defines the new card type. ''<lib>'' specifies the operationg system specific driver of the card. If 32 bit and 64 bit platforms requires different driver this seperation is indicated as follows: |
- | Eğer 32 ve 64 bit mimariler için farklı driver gerekiyorsa bu ayrım ''arch'' özelliği ile aşağıdaki gibi belirtilir. | + | |
<sxh xml> | <sxh xml> | ||
<card-type name="NCIPHER"> | <card-type name="NCIPHER"> | ||
Satır 44: | Satır 44: | ||
==== ATR Değeri ==== | ==== ATR Değeri ==== | ||
- | Kart tipini anlamak için karta özel ATR değerini bilmek gerekmektedir. ATR, Answer To Reset ifadesinin kısaltmasıdır. Protokol gereği kart resetlendiğinde tanıtıcı bir byte dizisi gönderir. Eğer bu byte dizisi biliniyorsa, ve karta özel ayırdedici bilgi içeriyorsa(historical bytes) kart tipi tespit edilebilir. Bilinen her bir ATR byte dizisi için ''<card-type>'' elemanı içine yukarıdaki örnekteki gibi bir ''<atr>'' elemanı eklenmelidir. | + | To detect the card type you need to know the ATR (Answer To Reset) value of the card. As defined in the communication protocol of the card, it sends out a byte sequence when it is reset. If this byte sequence is known and it includes a unique information for a specific card then the card type is detected. For all known ATR sequences there must be an ''<atr>'' element in ''<card-type>'' in the configuration file. |
- | Java ile ATR değeri hesaplamak için aşağıdaki kod parçasını kullanabilirsiniz. Kod ilk terminaldeki(kart okuyucu) akıllı kartın ATRsini ekrana yazdırmaktadır. | + | To retrieve ATR value from a card with Java, you can use the code segment below. The code simply prints out the ATR of the smartcard in the first reader. |
<sxh java;title:Java> | <sxh java;title:Java> | ||
Card card = TerminalFactory.getDefault().terminals().list().get(0).connect("*"); | Card card = TerminalFactory.getDefault().terminals().list().get(0).connect("*"); | ||
Satır 55: | Satır 55: | ||
System.out.println("ATR >"+atrHex); | System.out.println("ATR >"+atrHex); | ||
</sxh> | </sxh> | ||
- |