Skip to content

Identify one card from another #18

Description

@akerl

I'm using this module via https://github.com/yawn/ykoath/blob/master/ykoath.go and running into something I'd like to implement.

Right now, if I have multiple yubikeys plugged in, they get the same reader name, suffixed with an integer, but the naming is based on insertion order, so it changes depending on which device I plug in first.

As an example:

package main

import (
	"fmt"

	"github.com/ebfe/scard"
)

func main() {
	context, err := scard.EstablishContext()
	if err != nil {
		panic(err)
	}

	readers, err := context.ListReaders()
	if err != nil {
		panic(err)
	}

	for _, reader := range readers {
		fmt.Println(reader)
	}
}
❯ go run ./main.go
Yubico YubiKey OTP+FIDO+CCID
Yubico YubiKey OTP+FIDO+CCID 01

I poked around a bit at this library to see if there's a way to pull a unique identifier from the attributes, but this seems like the obly attributes that the yubikey supports (thought supports is a bit of a stretch, given that most of them are blank):

Yubico YubiKey OTP+FIDO+CCID 01: AttrChannelId:
Yubico YubiKey OTP+FIDO+CCID 01: AttrIccPresence:
Yubico YubiKey OTP+FIDO+CCID 01: AttrIccInterfaceStatus:
Yubico YubiKey OTP+FIDO+CCID 01: AttrAtrString: ;��1��s�!�WYubiKey@
Yubico YubiKey OTP+FIDO+CCID 01: AttrMaxinput: �

Yubico YubiKey OTP+FIDO+CCID 01: AttrVendorName: Yubico
Yubico YubiKey OTP+FIDO+CCID 01: AttrVendorIfdVersion: C
Yubico YubiKey OTP+FIDO+CCID 01: AttrVendorIfdSerialNo:

Are you aware of a way I can differentiate between the smartcards in a deterministic way?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions