ebfe / go.pcsclite Goto Github PK
View Code? Open in Web Editor NEWDeprecated. Try https://github.com/ebfe/scard.
Deprecated. Try https://github.com/ebfe/scard.
Hi @ebfe,
I'm unable to find any licensing info in your repo. Right now your work is non-free software.
Could you please specify the license?
Thanks.
With go1 (default on ubuntu)
go get github.com/ebfe/go.pcsclite/scard
# github.com/ebfe/go.pcsclite/scard
scard.go:85[/tmp/go-build170868432/github.com/ebfe/go.pcsclite/scard/_obj/scard.cgo1.go:107]: function ends without a return statement
Indeed, in this function, all the retuen are inside the switch, adding on at the end would probably solve the trouble.
I'm trying to write a small Go program to talk to my Yubikey Neo, but I'm having trouble getting go.pcsclite
to recognise it.
I've installed pcsc-lite
via Homebrew (v1.8.13), and I know the Yubikey is plugged in and working because pcsctest
, opensc-tool
, ykinfo
and ykneomgr
can all see it.
❯ pcsctest
MUSCLE PC/SC Lite Test Program
Testing SCardEstablishContext : Command successful.
Testing SCardGetStatusChange
Please insert a working reader : Command successful.
Testing SCardListReaders : Command successful.
Reader 01: Yubico Yubikey NEO OTP+CCID
❯ opensc-tool --list-readers
# Detected readers (pcsc)
Nr. Card Features Name
0 Yes Yubico Yubikey NEO OTP+CCID
❯ ykinfo -a
serial: 1234567
serial_hex: a1b2c3
serial_modhex: modhex
version: 3.3.0
touch_level: 1551
programming_sequence: 3
slot1_status: 1
slot2_status: 1
vendor_id: 1050
product_id: 111
❯ ykneomgr --list-readers
0: Yubico Yubikey NEO OTP+CCID
My program looks like this:
package main
import (
"fmt"
"github.com/ebfe/go.pcsclite/scard"
)
func main() {
ctx, err := scard.EstablishContext()
if err != nil {
panic(err)
}
readers, err := ctx.ListReaders()
if err != nil {
panic(err)
}
fmt.Println(readers)
}
The error I'm seeing is this:
❯ go build && ./yubigo-oath
panic: scard: Cannot find a smart card reader.
goroutine 16 [running]:
runtime.panic(0x40bca20, 0x8010002e)
/brew/Cellar/go/1.3.3/libexec/src/pkg/runtime/panic.c:279 +0xf5
main.main()
/Users/james/Projects/jamesottaway/yubigo-oath/main.go:15 +0xd3
I'm running pcscd
in debug mode, and it gives the following output:
❯ sudo pcscd -fd
00000000 debuglog.c:292:DebugLogSetLevel() debug level=debug
00000089 configfile.l:355:DBGetReaderList() Parsing conf file: /brew/Cellar/pcsc-lite/1.8.13/etc/reader.conf.d
00000008 pcscdaemon.c:569:main() pcsc-lite 1.8.13 daemon ready.
09077573 winscard_msg_srv.c:253:ProcessEventsServer() Common channel packet arrival
00000024 winscard_msg_srv.c:265:ProcessEventsServer() ProcessCommonChannelRequest detects: 5
00000005 pcscdaemon.c:134:SVCServiceRunLoop() A new context thread creation is requested: 5
00000052 winscard_svc.c:331:ContextThread() Authorized PC/SC client
00000005 winscard_svc.c:335:ContextThread() Thread is started: dwClientID=5, threadContext @0x7ff749e0a8d0
00000012 winscard_svc.c:353:ContextThread() Received command: CMD_VERSION from client 5
00000005 winscard_svc.c:365:ContextThread() Client is protocol version 4:3
00000002 winscard_svc.c:385:ContextThread() CMD_VERSION rv=0x0 for client 5
00000064 winscard_svc.c:353:ContextThread() Received command: ESTABLISH_CONTEXT from client 5
00000256 winscard.c:216:SCardEstablishContext() Establishing Context: 0x18A4445A
00000016 winscard_svc.c:446:ContextThread() ESTABLISH_CONTEXT rv=0x0 for client 5
00000076 winscard_svc.c:353:ContextThread() Received command: CMD_GET_READERS_STATE from client 5
00000631 winscard_svc.c:345:ContextThread() Client die: 5
00000014 winscard.c:227:SCardReleaseContext() Releasing Context: 0x18A4445A
00000008 winscard_svc.c:978:MSGCleanupClient() Thread is stopping: dwClientID=5, threadContext @0x7ff749e0a8d0
00000004 winscard_svc.c:984:MSGCleanupClient() Freeing SCONTEXT @0x7ff749e0a8d0
Is there something I'm missing here?
https://gopkgdoc.appspot.com/pkg/github.com/ebfe/go.pcsclite/scard returns an error 404:
Error: Not Found
The requested URL /pkg/github.com/ebfe/go.pcsclite/scard was not found on this server.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.