i found out how to fix this 3des issue the missing step is very easy just append after the line
FPrivKey := Pass2Key( TV3KeyType.PrivKey, FPrivPassword ); one more step if the key is smaller than 32 if Length( FPrivKey ) < 32 then FPrivKey := FPrivKey + Pass2Key( TV3KeyType.PrivKey, FPrivKey ); it is not yet perfect because it must be something like this while Length( FPrivKey ) < 32 do ... but for the moment its working for me, i will send the correct version sson cheers k1 Am 2016-01-06 20:57, schrieb ung...@its-pro.net: >> Nice shot, thank you! > > you are welcome > >> Do you know what ExtendShortKey does? > > yes, this is the description from the c# lib > Extends the encryption key if key size returned by PasswordToKey is > less then minimum required by the encryption protocol. > > and this is with 3des 32 > > here is the source from the c# lib > > public byte[] ExtendShortKey(byte[] shortKey, byte[] password, byte[] > engineID, IAuthenticationDigest authProtocol) > { > int length = shortKey.Length; > byte[] extendedKey = new byte[MinimumKeyLength]; > Buffer.BlockCopy(shortKey, 0, extendedKey, 0, shortKey.Length); > > while (length < MinimumKeyLength) > { > byte[] key = > authProtocol.PasswordToKey(shortKey, engineID); > int copyBytes = Math.Min(MaximumKeyLength - length, > authProtocol.DigestLength); > Buffer.BlockCopy(key, 0, extendedKey, length, copyBytes); > length += copyBytes; > } > return extendedKey; > } > > cheers k1 > > >> >> >>> hi everybody, >>> >>> i found the problem with the 3des encryption >>> i have comparen the snmpsend source code with the snmpsharpnet source >>> code >>> and the problem is in the EncryptPDU >>> branch >>> >>> this line >>> FPrivKey := Pass2Key( TV3KeyType.PrivKey, FPrivPassword ); >>> >>> gives the same result as the c# library but in the c# library you can >>> see, than when the length of the key is smaler than 32 we have to do >>> another step >>> >>> in c# its this lines >>> if( encryptionKey.Length < MinimumKeyLength ) >>> encryptionKey = ExtendShortKey(encryptionKey, secret, engineId, >>> authProtocol); >>> >>> and this step is missing i think in snmpsend and thats why the >>> calculated key is wrong >>> >>> i will try to imnplement this extra function >>> if someone wants to try, i can offen an open port to a working 3des >>> agent, all the free available 3des agents are also not correct >>> implemented >>> >>> thanks >>> k1 >>> >>> >>> ------------------------------------------------------------------------------ >>> _______________________________________________ >>> synalist-public mailing list >>> synalist-public@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/synalist-public ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ synalist-public mailing list synalist-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synalist-public