Attention is currently required from: laforge, neels.

Hoernchen has posted comments on this change by neels. ( 
https://gerrit.osmocom.org/c/pysim/+/40201?usp=email )

Change subject: personalization: make AlgorithmID a new EnumParam
......................................................................


Patch Set 5:

(1 comment)

Patchset:

PS5:
> (Slight counter argument: This is not a map to the binary representation. […]
as far as I know the compiled asn1 representation loses the schema 
information/name, so you would need to access the schema instead. a somewhat 
concise way would be something like this, by getting the schema as well in 
compile_asn1_subdir and then working with the schema dict. this would basically 
leave the compiled asn1 alone and would not interfere with anything else:

    def compile_asn1_subdir(subdir_name:str, codec='der'):
        """Helper function that compiles ASN.1 syntax from all files within 
given subdir"""
        import asn1tools
        asn_txt = ''
        __ver = sys.version_info
        if (__ver.major, __ver.minor) >= (3, 9):
            for i in 
resources.files('pySim.esim').joinpath('asn1').joinpath(subdir_name).iterdir():
                asn_txt += i.read_text()
                asn_txt += "\n"
        #else:
            #print(resources.read_text(__name__, 'asn1/rsp.asn'))
        asn1_schema = asn1tools.parse_string(asn_txt, codec=codec)
        return asn1tools.compile_dict(asn1_schema, codec='ber'), asn1_schema




in saip/__init__.py

    asn1, asn1_schema = compile_asn1_subdir('saip') # or asn, _ = 
compile_asn1_subdir(...) if schema not needed

somewhere else

    from pySim.esim.saip import asn1_schema as saip_schema
    
print(saip_schema['PEDefinitions']['types']['AlgoParameter']['members'][0]['named-numbers'])
    # {'milenage': 1, 'tuak': 2, 'usim-test-algorithm': 3}



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/40201?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I71c2ec1b753c66cb577436944634f32792353240
Gerrit-Change-Number: 40201
Gerrit-PatchSet: 5
Gerrit-Owner: neels <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: Hoernchen <[email protected]>
Gerrit-CC: laforge <[email protected]>
Gerrit-Attention: neels <[email protected]>
Gerrit-Attention: laforge <[email protected]>
Gerrit-Comment-Date: Thu, 15 Jan 2026 13:31:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <[email protected]>
Comment-In-Reply-To: laforge <[email protected]>

Reply via email to