diff --git a/snimpy/snmp.py b/snimpy/snmp.py index 1209aaa..d04a4bc 100644 --- a/snimpy/snmp.py +++ b/snimpy/snmp.py @@ -106,8 +106,8 @@ def __init__(self, host, :param secname: Security name to use for SNMPv3 only. :type secname: str :param authprotocol: Authorization protocol to use for - SNMPv3. This can be `None` or either the string `SHA` or - `MD5`. + SNMPv3. This can be `None` or one of the strings `SHA`, + `MD5`, `SHA224`, `SHA256`, `SHA384` or `SHA512`. :type authprotocol: None or str :param authpassword: Authorization password if authorization protocol is not `None`. @@ -154,7 +154,11 @@ def __init__(self, host, None: cmdgen.usmNoAuthProtocol, "MD5": cmdgen.usmHMACMD5AuthProtocol, "SHA": cmdgen.usmHMACSHAAuthProtocol, - "SHA1": cmdgen.usmHMACSHAAuthProtocol + "SHA1": cmdgen.usmHMACSHAAuthProtocol, + "SHA224": cmdgen.usmHMAC128SHA224AuthProtocol, + "SHA256": cmdgen.usmHMAC192SHA256AuthProtocol, + "SHA384": cmdgen.usmHMAC256SHA384AuthProtocol, + "SHA512": cmdgen.usmHMAC384SHA512AuthProtocol, }[authprotocol] except KeyError: raise ValueError("{} is not an acceptable authentication " diff --git a/tests/test_snmp.py b/tests/test_snmp.py index 6ec565f..538108a 100644 --- a/tests/test_snmp.py +++ b/tests/test_snmp.py @@ -70,7 +70,7 @@ def testSnmpV3(self): def testSnmpV3Protocols(self): """Check accepted auth and privacy protocols""" - for auth in ["MD5", "SHA"]: + for auth in ["MD5", "SHA", "SHA224", "SHA256", "SHA384", "SHA512"]: for priv in ["AES", "AES128", "DES"]: snmp.Session(host="localhost", version=3,