diff --git a/SharpSnmpLib/Security/AESPrivacyProviderBase.cs b/SharpSnmpLib/Security/AESPrivacyProviderBase.cs index 234445a9..f213a23e 100644 --- a/SharpSnmpLib/Security/AESPrivacyProviderBase.cs +++ b/SharpSnmpLib/Security/AESPrivacyProviderBase.cs @@ -402,19 +402,6 @@ public ISnmpData Encrypt(ISnmpData data, SecurityParameters parameters) var pkey = PasswordToKey(_phrase.GetRaw(), parameters.EngineId.GetRaw()); var bytes = data.ToBytes(); - var reminder = bytes.Length % 8; - var count = reminder == 0 ? 0 : 8 - reminder; - using (var stream = new MemoryStream()) - { - stream.Write(bytes, 0, bytes.Length); - for (var i = 0; i < count; i++) - { - stream.WriteByte(1); - } - - bytes = stream.ToArray(); - } - var encrypted = Encrypt(bytes, pkey, parameters.EngineBoots!.ToInt32(), parameters.EngineTime!.ToInt32(), parameters.PrivacyParameters!.GetRaw()); return new OctetString(encrypted); } @@ -509,7 +496,7 @@ internal byte[] ExtendShortKey(byte[] shortKey, byte[] engineId, IAuthentication else { Array.Copy(tmpBuf, 0, extKey, keyLen, MinimumKeyLength - keyLen); - keyLen += (MinimumKeyLength - keyLen); + keyLen += MinimumKeyLength - keyLen; } lastKeyBuf = new byte[tmpBuf.Length];