Skip to content

Commit

Permalink
Don't fail on ykneo-openpgp < 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Aug 30, 2024
1 parent 92af831 commit fad423c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions yubikit/openpgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,8 +1023,14 @@ def __init__(

def _read_version(self) -> Version:
logger.debug("Getting version number")
bcd = self.protocol.send_apdu(0, INS.GET_VERSION, 0, 0)
return Version(*(_bcd(x) for x in bcd))
try:
bcd = self.protocol.send_apdu(0, INS.GET_VERSION, 0, 0)
return Version(*(_bcd(x) for x in bcd))
except ApduError as e:
# Pre 1.0.2 versions don't support reading the version
if e.sw == SW.CONDITIONS_NOT_SATISFIED:
return Version(1, 0, 0)
raise

@property
def aid(self) -> OpenPgpAid:
Expand Down

0 comments on commit fad423c

Please sign in to comment.