This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/23423 ) Change subject: commands: better exception string for authentication failures ...................................................................... commands: better exception string for authentication failures At the moment we use the send_apdu_checksw() method to send the APDU for ADM authentication. This method only checks if the command returns with sw = 9000. If not it raises an exception that the sw is not as expected. The user may think that this is a problem with thr reader, pcscd or pySim in the first place and may try multiple times until the card is permanently locked. A better execption string that also displays the tries which are left may be helpful. Change-Id: Icf428831094f8c1045eefaa8cb2b92e6a36b0c13 Related: OS#4963 --- M pySim/commands.py 1 file changed, 4 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/pySim/commands.py b/pySim/commands.py index 2fb1041..9aed588 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -205,4 +205,7 @@ def verify_chv(self, chv_no, code): fc = rpad(b2h(code), 16) - return self._tp.send_apdu_checksw(self.cla_byte + '2000' + ('%02X' % chv_no) + '08' + fc) + data, sw = self._tp.send_apdu(self.cla_byte + '2000' + ('%02X' % chv_no) + '08' + fc) + if (sw != '9000'): + raise RuntimeError('Failed to authenticate with ADM key %s, %i tries left.' % (code, int(sw[3]))) + return (data,sw) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/23423 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Icf428831094f8c1045eefaa8cb2b92e6a36b0c13 Gerrit-Change-Number: 23423 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210323/b282556e/attachment.htm>