pySim/euicc: fix encoding/decoding of Iccid
The class Iccid uses a BcdAdapter to encoded/decode the ICCID. This works fine for ICCIDs that have an even (20) number of digits. In case the digit count is odd (19), the ICCID the last digit requires padding. Let's switch to PaddedBcdAdapter for encoding/decoding, to ensure that odd-length ICCIDs are padded automatically. Change-Id: I527a44ba454656a0d682ceb590eec6d9d0ac883a Related: OS#6868
This commit is contained in:
@@ -181,7 +181,7 @@ class SeqNumber(BER_TLV_IE, tag=0x80):
|
|||||||
class NotificationAddress(BER_TLV_IE, tag=0x0c):
|
class NotificationAddress(BER_TLV_IE, tag=0x0c):
|
||||||
_construct = Utf8Adapter(GreedyBytes)
|
_construct = Utf8Adapter(GreedyBytes)
|
||||||
class Iccid(BER_TLV_IE, tag=0x5a):
|
class Iccid(BER_TLV_IE, tag=0x5a):
|
||||||
_construct = BcdAdapter(GreedyBytes)
|
_construct = PaddedBcdAdapter(GreedyBytes)
|
||||||
class NotificationMetadata(BER_TLV_IE, tag=0xbf2f, nested=[SeqNumber, ProfileMgmtOperation,
|
class NotificationMetadata(BER_TLV_IE, tag=0xbf2f, nested=[SeqNumber, ProfileMgmtOperation,
|
||||||
NotificationAddress, Iccid]):
|
NotificationAddress, Iccid]):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"profile_info": {
|
"profile_info": {
|
||||||
"iccid": "8949449999999990031f",
|
"iccid": "8949449999999990031",
|
||||||
"isdp_aid": "a0000005591010ffffffff8900001200",
|
"isdp_aid": "a0000005591010ffffffff8900001200",
|
||||||
"profile_state": "disabled",
|
"profile_state": "disabled",
|
||||||
"service_provider_name": "OsmocomSPN",
|
"service_provider_name": "OsmocomSPN",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import os
|
|||||||
import json
|
import json
|
||||||
from utils import *
|
from utils import *
|
||||||
|
|
||||||
# This testcase requires a sysmoEUICC1-C2T with the test prfile TS48V1-B-UNIQUE (ICCID 8949449999999990031f)
|
# This testcase requires a sysmoEUICC1-C2T with the test prfile TS48V1-B-UNIQUE (ICCID 8949449999999990031)
|
||||||
# installed, and in disabled state. Also the profile must be installed in such a way that notifications are
|
# installed, and in disabled state. Also the profile must be installed in such a way that notifications are
|
||||||
# generated when the profile is disabled or enabled (ProfileMetadata)
|
# generated when the profile is disabled or enabled (ProfileMetadata)
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ set echo true
|
|||||||
select ADF.ISD-R
|
select ADF.ISD-R
|
||||||
|
|
||||||
# Generate two (additional) notifications by quickly enabeling the test profile
|
# Generate two (additional) notifications by quickly enabeling the test profile
|
||||||
enable_profile --iccid 8949449999999990031f
|
enable_profile --iccid 8949449999999990031
|
||||||
enable_profile --iccid 89000123456789012341
|
enable_profile --iccid 89000123456789012341
|
||||||
|
|||||||
Reference in New Issue
Block a user