From 539364846a89987ac2679988653f50332cb91d26 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 30 Aug 2012 21:06:13 +0000 Subject: Implemented 1.3.2 protocol encryption using CryptoPP, up to Client Status packet (http://wiki.vg/Protocol_FAQ step 14) git-svn-id: http://mc-server.googlecode.com/svn/trunk@808 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- CryptoPP/dh2.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 CryptoPP/dh2.cpp (limited to 'CryptoPP/dh2.cpp') diff --git a/CryptoPP/dh2.cpp b/CryptoPP/dh2.cpp new file mode 100644 index 000000000..98175ee28 --- /dev/null +++ b/CryptoPP/dh2.cpp @@ -0,0 +1,22 @@ +// dh2.cpp - written and placed in the public domain by Wei Dai + +#include "pch.h" +#include "dh2.h" + +NAMESPACE_BEGIN(CryptoPP) + +void DH2_TestInstantiations() +{ + DH2 dh(*(SimpleKeyAgreementDomain*)NULL); +} + +bool DH2::Agree(byte *agreedValue, + const byte *staticSecretKey, const byte *ephemeralSecretKey, + const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, + bool validateStaticOtherPublicKey) const +{ + return d1.Agree(agreedValue, staticSecretKey, staticOtherPublicKey, validateStaticOtherPublicKey) + && d2.Agree(agreedValue+d1.AgreedValueLength(), ephemeralSecretKey, ephemeralOtherPublicKey, true); +} + +NAMESPACE_END -- cgit v1.2.3