From 2e2ad5e47b04e8f25744d03ab71a51b8368094d1 Mon Sep 17 00:00:00 2001 From: oepen Date: Thu, 1 Sep 2011 14:42:34 +0000 Subject: [PATCH] Added some documentation git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@514 96b47cad-a561-4643-ad3b-153ac7d7599c --- .../src/vpicc/virtualsmartcard/CryptoUtils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/CryptoUtils.py b/virtualsmartcard/src/vpicc/virtualsmartcard/CryptoUtils.py index fff5add..f185b31 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/CryptoUtils.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/CryptoUtils.py @@ -112,7 +112,6 @@ def strip_padding(cipherspec, data, padding_class=0x01): Strip the padding of decrypted data. Returns data without padding """ - #TODO: Sanity check if padding_class == 0x01: tail = len(data) - 1 while data[tail] != '\x80': @@ -120,6 +119,17 @@ def strip_padding(cipherspec, data, padding_class=0x01): return data[:tail] def crypto_checksum(algo, key, data, iv=None, ssc=None): + """ + Compute various types of cryptographic checksums. + @param algo: A string specifying the algorithm to use. Currently supported + algorithms are \"MAX\" \"HMAC\" and \"CC\" (Meaning a + cryptographic checksum as used by the ICAO passports) + @param key: They key used to computed the cryptographic checksum + @param data: The data for which to calculate the checksum + @iv: Optional. An initialization vector. Only used by the \"MAC\" algorithm + @ssc: Optional. A send sequence counter to be prepended to the data. Only + used by the \"CC\" algorithm + """ if algo not in ("HMAC", "MAC", "CC"): raise ValueError, "Unknown Algorithm %s" % algo