Skip to content

Commit

Permalink
modified: scapy/contrib/automotive/uds.py
Browse files Browse the repository at this point in the history
                added descriptions for NRC 0x50-0x5D
            modified:   test/contrib/automotive/uds.uts
                added test for NRC description 0x50
  • Loading branch information
bwagner committed Sep 10, 2024
1 parent 32c79ba commit 906e636
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scapy/contrib/automotive/uds.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,20 @@ class UDS_NR(Packet):
0x36: 'exceedNumberOfAttempts',
0x37: 'requiredTimeDelayNotExpired',
0x3A: 'secureDataVerificationFailed',
0x50: 'certificateVerificationFailedInvalidTimePeriod',
0x51: 'certificateVerificationFailedInvalidSignature',
0x52: 'certificateVerificationFailedInvalidChainOfTrust',
0x53: 'certificateVerificationFailedInvalidType',
0x54: 'certificateVerificationFailedInvalidFormat',
0x55: 'certificateVerificationFailedInvalidContent',
0x56: 'certificateVerificationFailedInvalidScope',
0x57: 'certificateVerificationFailedInvalidCertificateRevoked',
0x58: 'ownershipVerificationFailed',
0x59: 'challengeCalculationFailed',
0x5a: 'settingAccessRightsFailed',
0x5b: 'sessionKeyCreationOrDerivationFailed',
0x5c: 'configurationDataUsageFailed',
0x5d: 'deAuthenticationFailed',
0x70: 'uploadDownloadNotAccepted',
0x71: 'transferDataSuspended',
0x72: 'generalProgrammingFailure',
Expand Down
7 changes: 7 additions & 0 deletions test/contrib/automotive/uds.uts
Original file line number Diff line number Diff line change
Expand Up @@ -1423,3 +1423,10 @@ nrc = UDS(b'\x7f\x22\x33')
assert nrc.service == 0x7f
assert nrc.requestServiceId == 0x22
assert nrc.negativeResponseCode == 0x33


= Check UDS get negative Response Description

nrcDescription = UDS_NR.negativeResponseCodes.get(0x50)
assert nrcDescription == 'Certificate verification failed - Invalid Time Period'

0 comments on commit 906e636

Please sign in to comment.