Documentation ¶
Overview ¶
Package card provides functions for communication with smart cards. It includes implementations for handling different types of smart cards and reading associated documents.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var APOLLO_ATR = []byte{
0x3B, 0xB9, 0x18, 0x00, 0x81, 0x31, 0xFE, 0x9E, 0x80,
0x73, 0xFF, 0x61, 0x40, 0x83, 0x00, 0x00, 0x00, 0xDF,
}
var DOCUMENT_FILE_LOC = []byte{0x0F, 0x02}
Location of the file with document data.
var ErrInvalidFormat = errors.New("invalid format")
var ErrInvalidLength = errors.New("invalid length")
var GEMALTO_ATR_1 = []byte{
0x3B, 0xFF, 0x94, 0x00, 0x00, 0x81, 0x31, 0x80,
0x43, 0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x02,
0x01, 0xF3, 0x12, 0x0F, 0xFF, 0x82, 0x90, 0x00,
0x79,
}
var GEMALTO_ATR_2 = []byte{
0x3B, 0xF9, 0x96, 0x00, 0x00, 0x80, 0x31, 0xFE,
0x45, 0x53, 0x43, 0x45, 0x37, 0x20, 0x47, 0x43,
0x4E, 0x33, 0x5E,
}
Available since January 2023 (maybe). Replaced very soon with an even newer version.
var GEMALTO_ATR_3 = []byte{
0x3B, 0x9E, 0x96, 0x80, 0x31, 0xFE, 0x45, 0x53,
0x43, 0x45, 0x20, 0x38, 0x2E, 0x30, 0x2D, 0x43,
0x31, 0x56, 0x30, 0x0D, 0x0A, 0x6F,
}
Available since July 2023.
var GEMALTO_ATR_4 = []byte{
0x3B, 0x9E, 0x96, 0x80, 0x31, 0xFE, 0x45, 0x53,
0x43, 0x45, 0x20, 0x38, 0x2E, 0x30, 0x2D, 0x43,
0x32, 0x56, 0x30, 0x0D, 0x0A, 0x6C,
}
Available since June 2024.
var MEDICAL_ATR = []byte{
0x3B, 0xF4, 0x13, 0x00, 0x00, 0x81, 0x31, 0xFE,
0x45, 0x52, 0x46, 0x5A, 0x4F, 0xED,
}
Possibly the first version of the medical card. Newer version has the GEMALTO_ATR_2 for the ATR.
var MEDICAL_ATR_2 = []byte{
0x3B, 0x9E, 0x97, 0x80, 0x31, 0xFE, 0x45, 0x53,
0x43, 0x45, 0x20, 0x38, 0x2E, 0x30, 0x2D, 0x43,
0x31, 0x56, 0x30, 0x0D, 0x0A, 0x6E,
}
Available since March 2023?
var PERSONAL_FILE_LOC = []byte{0x0F, 0x03}
Location of the file with personal data.
var PHOTO_FILE_LOC = []byte{0x0F, 0x06}
Location of the the portrait. Portrait is encoded as JPEG.
var RESIDENCE_FILE_LOC = []byte{0x0F, 0x04}
Location of the file with residence data.
var VEHICLE_ATR_0 = []byte{
0x3B, 0xDB, 0x96, 0x00, 0x80, 0xB1, 0xFE, 0x45,
0x1F, 0x83, 0x00, 0x31, 0xC0, 0x64, 0x1A, 0x18,
0x01, 0x00, 0x0F, 0x90, 0x00, 0x52,
}
Possibly deprecated.
var VEHICLE_ATR_1 = []byte{
0x3B, 0xFF, 0x94, 0x00, 0x00, 0x81, 0x31, 0x80,
0x43, 0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x02,
0x01, 0xF3, 0x12, 0x0F, 0xFF, 0x82, 0x90, 0x00,
0x79,
}
var VEHICLE_ATR_2 = []byte{
0x3B, 0x9D, 0x13, 0x81, 0x31, 0x60, 0x37, 0x80,
0x31, 0xC0, 0x69, 0x4D, 0x54, 0x43, 0x4F, 0x53,
0x73, 0x02, 0x02, 0x04, 0x40,
}
var VEHICLE_ATR_3 = []byte{
0x3B, 0x9D, 0x13, 0x81, 0x31, 0x60, 0x37, 0x80,
0x31, 0xC0, 0x69, 0x4D, 0x54, 0x43, 0x4F, 0x53,
0x73, 0x02, 0x05, 0x04, 0x47,
}
var VEHICLE_ATR_4 = []byte{
0x3B, 0x9D, 0x18, 0x81, 0x31, 0xFC, 0x35, 0x80,
0x31, 0xC0, 0x69, 0x4D, 0x54, 0x43, 0x4F, 0x53,
0x73, 0x02, 0x05, 0x02, 0xD4,
}
Functions ¶
Types ¶
type Apollo ¶
type Apollo struct {
// contains filtered or unexported fields
}
Apollo is the type of the first smart ID cards. Apollo cards are not manufactured anymore, and this code could be removed in the future.
type BER ¶ added in v1.4.0
type BER struct {
// contains filtered or unexported fields
}
Represents a node (or a tree) of a BER structure. Each leaf node contains data, and it is considered 'primitive'. Non-leaf nodes don't contain any data, but they contain references to child nodes.
type Card ¶
Represents a physical or virtual smart card. Essentially it is just a wrapper for the scard.Card type, but it also allows virtual cards which can be useful for testing.
type CardDocument ¶ added in v1.5.2
type CardDocument interface {
// contains filtered or unexported methods
}
Represents a smart card with a document. All types of documents that Bas Celik can read should satisfy this interface
type Gemalto ¶
type Gemalto struct {
// contains filtered or unexported fields
}
Gemalto represents ID cards based with Gemalto Java OS. Gemalto replaced Apollo cards around 2014.
type IdDocument ¶ added in v1.5.2
type IdDocument interface { Apollo | Gemalto CardDocument }
Represents a smart card that contains a Serbian ID document.
type MedicalCard ¶ added in v1.2.0
type MedicalCard struct {
// contains filtered or unexported fields
}
Represents a smart card that holds a Serbian medical insurance document.
type VehicleCard ¶ added in v1.4.0
type VehicleCard struct {
// contains filtered or unexported fields
}
Represents a smart card that contains a Serbian vehicle document.
type VirtualCard ¶ added in v1.5.2
type VirtualCard struct {
// contains filtered or unexported fields
}
func MakeVirtualCard ¶ added in v1.5.2
func MakeVirtualCard(atr []byte, fs map[uint32][]byte) *VirtualCard
func (*VirtualCard) Status ¶ added in v1.5.2
func (card *VirtualCard) Status() (*scard.CardStatus, error)