mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-29 19:10:59 +03:00
osmo-smdpp: Get rid of hard-coded ICCID
Read the ICCID from the header of the UPP when building the ProfileMetdata. This allows the download of profiles with arbitrary ICCID. Change-Id: I1b9e17f757f9935436828e6dc1ab75ff17d1d1a4
This commit is contained in:
@@ -35,6 +35,7 @@ import asn1tools
|
|||||||
from pySim.utils import h2b, b2h, swap_nibbles
|
from pySim.utils import h2b, b2h, swap_nibbles
|
||||||
|
|
||||||
import pySim.esim.rsp as rsp
|
import pySim.esim.rsp as rsp
|
||||||
|
from pySim.esim import saip
|
||||||
from pySim.esim.es8p import *
|
from pySim.esim.es8p import *
|
||||||
from pySim.esim.x509_cert import oid, cert_policy_has_oid, cert_get_auth_key_id
|
from pySim.esim.x509_cert import oid, cert_policy_has_oid, cert_get_auth_key_id
|
||||||
from pySim.esim.x509_cert import CertAndPrivkey, CertificateSet, cert_get_subject_key_id, VerifyError
|
from pySim.esim.x509_cert import CertAndPrivkey, CertificateSet, cert_get_subject_key_id, VerifyError
|
||||||
@@ -363,11 +364,14 @@ class SmDppHttpServer:
|
|||||||
if not os.path.isfile(path) or not os.access(path, os.R_OK):
|
if not os.path.isfile(path) or not os.access(path, os.R_OK):
|
||||||
raise ApiError('8.2.6', '3.8', 'Refused')
|
raise ApiError('8.2.6', '3.8', 'Refused')
|
||||||
ss.matchingId = matchingId
|
ss.matchingId = matchingId
|
||||||
|
with open(path, 'rb') as f:
|
||||||
|
pes = saip.ProfileElementSequence.from_der(f.read())
|
||||||
|
iccid_str = b2h(pes.get_pe_for_type('header').decoded['iccid'])
|
||||||
|
|
||||||
# FIXME: we actually want to perform the profile binding herr, and read the profile metadat from the profile
|
# FIXME: we actually want to perform the profile binding herr, and read the profile metadat from the profile
|
||||||
|
|
||||||
# Put together profileMetadata + _bin
|
# Put together profileMetadata + _bin
|
||||||
ss.profileMetadata = ProfileMetadata(iccid_bin= h2b(swap_nibbles('89000123456789012358')), spn="OsmocomSPN", profile_name="OsmocomProfile")
|
ss.profileMetadata = ProfileMetadata(iccid_bin=h2b(swap_nibbles(iccid_str)), spn="OsmocomSPN", profile_name=matchingId)
|
||||||
profileMetadata_bin = ss.profileMetadata.gen_store_metadata_request()
|
profileMetadata_bin = ss.profileMetadata.gen_store_metadata_request()
|
||||||
|
|
||||||
# Put together smdpSigned2 + _bin
|
# Put together smdpSigned2 + _bin
|
||||||
|
|||||||
Reference in New Issue
Block a user