laforge submitted this change.
[cosmetic] esim: Fix various typos in comments/messages/docs
Change-Id: I806c7a37951e72027ab9346169a3f8fe241f2c46
---
M pySim/esim/bsp.py
M pySim/esim/http_json_api.py
M pySim/esim/saip/personalization.py
M pySim/esim/x509_cert.py
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/pySim/esim/bsp.py b/pySim/esim/bsp.py
index 24634a7..862502f 100644
--- a/pySim/esim/bsp.py
+++ b/pySim/esim/bsp.py
@@ -225,7 +225,7 @@
return cls(s_enc, s_mac, initial_mcv)
def encrypt_and_mac_one(self, tag: int, plaintext:bytes) -> bytes:
- """Encrypt + MAC a single plaintext TLV. Returns the protected ciphertex."""
+ """Encrypt + MAC a single plaintext TLV. Returns the protected ciphertext."""
assert tag <= 255
assert len(plaintext) <= self.max_payload_size
logger.debug("encrypt_and_mac_one(tag=0x%x, plaintext=%s)", tag, b2h(plaintext))
@@ -250,11 +250,11 @@
return result
def mac_only_one(self, tag: int, plaintext: bytes) -> bytes:
- """MAC a single plaintext TLV. Returns the protected ciphertex."""
+ """MAC a single plaintext TLV. Returns the protected ciphertext."""
assert tag <= 255
assert len(plaintext) < self.max_payload_size
maced = self.m_algo.auth(tag, plaintext)
- # The data block counter for ICV caluclation is incremented also for each segment with C-MAC only.
+ # The data block counter for ICV calculation is incremented also for each segment with C-MAC only.
self.c_algo.block_nr += 1
return maced
@@ -288,7 +288,7 @@
def demac_only_one(self, ciphertext: bytes) -> bytes:
payload = self.m_algo.verify(ciphertext)
_tdict, _l, val, _remain = bertlv_parse_one(payload)
- # The data block counter for ICV caluclation is incremented also for each segment with C-MAC only.
+ # The data block counter for ICV calculation is incremented also for each segment with C-MAC only.
self.c_algo.block_nr += 1
return val
diff --git a/pySim/esim/http_json_api.py b/pySim/esim/http_json_api.py
index 6a803f2..ae32ba1 100644
--- a/pySim/esim/http_json_api.py
+++ b/pySim/esim/http_json_api.py
@@ -26,15 +26,15 @@
logger.setLevel(logging.DEBUG)
class ApiParam(abc.ABC):
- """A class reprsenting a single parameter in the API."""
+ """A class representing a single parameter in the API."""
@classmethod
def verify_decoded(cls, data):
- """Verify the decoded reprsentation of a value. Should raise an exception if somthing is odd."""
+ """Verify the decoded representation of a value. Should raise an exception if something is odd."""
pass
@classmethod
def verify_encoded(cls, data):
- """Verify the encoded reprsentation of a value. Should raise an exception if somthing is odd."""
+ """Verify the encoded representation of a value. Should raise an exception if something is odd."""
pass
@classmethod
diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py
index f9451d1..61973e7 100644
--- a/pySim/esim/saip/personalization.py
+++ b/pySim/esim/saip/personalization.py
@@ -67,7 +67,7 @@
If the string of digits is only 18 digits long, a Luhn check digit will be added."""
def validate(self):
- # convert to string as it migt be an integer
+ # convert to string as it might be an integer
iccid_str = str(self.input_value)
if len(iccid_str) < 18 or len(iccid_str) > 20:
raise ValueError('ICCID must be 18, 19 or 20 digits long')
@@ -86,7 +86,7 @@
the last digit of the IMSI."""
def validate(self):
- # convert to string as it migt be an integer
+ # convert to string as it might be an integer
imsi_str = str(self.input_value)
if len(imsi_str) < 6 or len(imsi_str) > 15:
raise ValueError('IMSI must be 6..15 digits long')
@@ -300,7 +300,7 @@
class AlgoConfig(ConfigurableParameter, metaclass=ClassVarMeta):
- """Configurable Algorithm parameter. bytes."""
+ """Configurable Algorithm parameter."""
key = None
def validate(self):
if not isinstance(self.input_value, (io.BytesIO, bytes, bytearray)):
diff --git a/pySim/esim/x509_cert.py b/pySim/esim/x509_cert.py
index 3bcf8a2..e951de7 100644
--- a/pySim/esim/x509_cert.py
+++ b/pySim/esim/x509_cert.py
@@ -31,7 +31,7 @@
"""Verify if 'signed' certificate was signed using 'signer'."""
# this code only works for ECDSA, but this is all we need for GSMA eSIM
pkey = signer.public_key()
- # this 'signed.signature_algorithm_parameters' below requires cryptopgraphy 41.0.0 :(
+ # this 'signed.signature_algorithm_parameters' below requires cryptography 41.0.0 :(
pkey.verify(signed.signature, signed.tbs_certificate_bytes, signed.signature_algorithm_parameters)
def cert_get_subject_key_id(cert: x509.Certificate) -> bytes:
@@ -189,7 +189,7 @@
def ecdsa_sign(self, plaintext: bytes) -> bytes:
"""Sign some input-data using an ECDSA signature compliant with SGP.22,
which internally refers to Global Platform 2.2 Annex E, which in turn points
- to BSI TS-03111 which states "concatengated raw R + S values". """
+ to BSI TS-03111 which states "concatenated raw R + S values". """
sig = self.priv_key.sign(plaintext, ec.ECDSA(hashes.SHA256()))
# convert from DER format to BSI TR-03111; first get long integers; then convert those to bytes
return ecdsa_dss_to_tr03111(sig)
To view, visit change 38900. To unsubscribe, or for help writing mail filters, visit settings.