INNER CODE UNIT · Go
parseSlot
go-piv/piv-go · v2/piv/key.go:294
func parseSlot(commonName string) (Slot, bool) {
if !strings.HasPrefix(commonName, yubikeySubjectCNPrefix) {
return Slot{}, false
}
slotName := strings.TrimPrefix(commonName, yubikeySubjectCNPrefix)
key, err := strconv.ParseUint(slotName, 16, 32)
if err != nil {
return Slot{}, false
}
switch uint32(key) {
case SlotAuthentication.Key:
return SlotAuthentication, true
case SlotSignature.Key:
return SlotSignature, true
case SlotCardAuthentication.Key:
return SlotCardAuthentication, true