go-card

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2018 License: MIT

README

Go Smart Card API

High level API for smart card integration written in pure Go. On Linx and other Unix-like systems, this package talks directly to the PCSC-Lite daemon, and on Windows it accesses the smart card service via winscard.dll.

Prerequisites

Linux

Install the PCSC-Lite daemon and CCID driver.

Ubuntu:

sudo apt-get install pcscd libccid

Arch Linux:

sudo pacman -S pcsclite ccid
sudo systemctl enable pcscd
OS X

Probably none. PCSC-Lite should come with the system.

Windows

None

Installation

go get github.com/sf1/go-card/smartcard

Usage

ctx, err := smartcard.EstablishContext()
// handle error, if any
defer ctx.Release()

reader, err := ctx.WaitForCardPresent()
// handle error, if any

card, err := reader.Connect()
// handle error, if any
defer card.Disconnect()

fmt.Printf("Card ATR: %s\n", card.ATR()) 
command := SelectCommand(0xa0, 0x00, 0x00, 0x00, 0x62, 0x03, 0x01, 0xc, 0x01, 0x01)
response, err := card.TransmitAPDU(command)
// handle error, if any
fmt.Printf("Response: %s\n", response)

License

MIT. See LICENSE

Directories

Path Synopsis
examples
Package smartcard implements a portable high-level API for communicating with smart cards.
Package smartcard implements a portable high-level API for communicating with smart cards.
SW

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL