[SNMP4J] 3DES implementation
Yue Zhang
Yue.zhang at emc.com
Mon Aug 8 18:13:31 CEST 2011
Hi Jochen,
Thanks a lot for your reply.
I implemented a temporary patch to Priv3DES for my testing. Could you please
review it?
public byte[] extendShortKey(byte[] shortKey, OctetString password,
byte[] engineID,
AuthenticationProtocol authProtocol) {
int length = shortKey.length;
byte[] extendedKey = new byte[getMinKeyLength()];
System.arraycopy(shortKey, 0, extendedKey, 0, shortKey.length);
byte[] key = new byte[getMinKeyLength()];
System.arraycopy(shortKey, 0, key, 0, shortKey.length);
while (length < getMinKeyLength()) {
key = authProtocol.passwordToKey(new OctetString(key, 0, length),
engineID);
int copyBytes = Math.min(getMinKeyLength() - length,
authProtocol.getDigestLength());
System.arraycopy(key, 0, extendedKey, length, copyBytes);
length += copyBytes;
}
return extendedKey;
}
Best Regards,
Yue
More information about the SNMP4J
mailing list