--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/weakCryptographicKey.py Tue Sep 13 19:46:19 2022 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/weakCryptographicKey.py Tue Sep 13 20:00:55 2022 +0200 @@ -102,9 +102,9 @@ @rtype bool """ funcKeyType = { - "cryptography.hazmat.primitives.asymmetric.dsa." "generate_private_key": "DSA", - "cryptography.hazmat.primitives.asymmetric.rsa." "generate_private_key": "RSA", - "cryptography.hazmat.primitives.asymmetric.ec." "generate_private_key": "EC", + "cryptography.hazmat.primitives.asymmetric.dsa.generate_private_key": "DSA", + "cryptography.hazmat.primitives.asymmetric.rsa.generate_private_key": "RSA", + "cryptography.hazmat.primitives.asymmetric.ec.generate_private_key": "EC", } argPosition = { "DSA": 0, @@ -122,12 +122,29 @@ elif keyType == "EC": curveKeySizes = { + "SECT571K1": 571, + "SECT571R1": 570, + "SECP521R1": 521, + "BrainpoolP512R1": 512, + "SECT409K1": 409, + "SECT409R1": 409, + "BrainpoolP384R1": 384, + "SECP384R1": 384, + "SECT283K1": 283, + "SECT283R1": 283, + "BrainpoolP256R1": 256, + "SECP256K1": 256, + "SECP256R1": 256, + "SECT233K1": 233, + "SECT233R1": 233, + "SECP224R1": 224, "SECP192R1": 192, "SECT163K1": 163, "SECT163R2": 163, } - curve = ( - context.getCallArgValue("curve") or context.callArgs[argPosition[keyType]] + curve = context.getCallArgValue("curve") or ( + len(context.callArgs) > argPosition[keyType] + and context.callArgs[argPosition[keyType]] ) keySize = curveKeySizes[curve] if curve in curveKeySizes else 224 return _classifyKeySize(reportError, config, keyType, keySize, context.node) @@ -161,6 +178,7 @@ context.getCallArgValue("bits") or context.getCallArgAtPosition(0) or 2048 ) return _classifyKeySize(reportError, config, keyType, keySize, context.node) + return False