diff options
author | Harald Welte <laforge@osmocom.org> | 2024-01-30 21:15:39 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2024-01-30 21:33:41 +0100 |
commit | 93bdf00967951a8e25665d0f9774bd9fe263892b (patch) | |
tree | 0b2ec88765cf58b948f8779cf1bae9e240c9877a /tests | |
parent | d7715043a31275fd0ed86407b84d78c240b2fbe4 (diff) |
pySim.esim: Add class for parsing/encoding eSIM activation codes
Change-Id: I2256722c04b56e8d9c16a65e3cd94f6a46f4ed85
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_esim.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_esim.py b/tests/test_esim.py index d4b494e..81926e5 100755 --- a/tests/test_esim.py +++ b/tests/test_esim.py @@ -22,9 +22,22 @@ import base64 from pySim.utils import b2h, h2b from pySim.esim.bsp import * import pySim.esim.rsp as rsp +from pySim.esim import ActivationCode from cryptography.hazmat.primitives.asymmetric import ec +class TestActivationCode(unittest.TestCase): + def test_de_encode(self): + STRS = ['1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815', + '1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815$$1', + '1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815$1.3.6.1.4.1.31746$1', + '1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815$1.3.6.1.4.1.31746', + '1$SMDP.GSMA.COM$$1.3.6.1.4.1.31746'] + for s in STRS: + ac = ActivationCode.from_string(s) + self.assertEqual(s, ac.to_string()) + + class TestECKA(unittest.TestCase): def test_mode51(self): curve = ec.SECP256R1() |