Skip to content

Commit dcde2f8

Browse files
meck-gdMeneDev
authored andcommitted
Fix APDU size limit for listing slots
An extended-length response is only sent when the request APDU is also extended-length. This is necessary when you have more than 6-7 slots in use on your key.
1 parent 85eaae4 commit dcde2f8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

yubikey/scard/scard_yubikey.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ func (key *scardYubiKey) GetCodeWithPassword(pwd string, slotName string) (strin
170170
panic("Verification failed")
171171
}
172172

173-
var cmd_5 = []byte{0x00, byte(CALCULATE_ALL), 0x00, 0x01, 0x0A, 0x74, 0x08}
173+
var cmd_5 = []byte{
174+
0x00, byte(CALCULATE_ALL), 0x00, 0x01,
175+
0x00, // This makes it an extended-length APDU
176+
0x00, 0x0A, // Payload size 0x000A
177+
0x74, 0x08, // There's going to be a time value of length 8
178+
}
174179

175180
timeBuffer := make([]byte, 8)
176181

0 commit comments

Comments
 (0)