如何将完全散列的 menezes-qu-vanstone (fhmqv) 补丁应用到已从 Ubuntu 存储库安装的 crypto++
How to apply the patch for fully hashed menezes-qu-vanstone (fhmqv) to crypto++ that has been installed from the Ubuntu repository
我想将椭圆曲线 Diffie-Hellman (ECDH) 密钥交换协议用于密钥协商过程。它已经在 crypto++ 库中实现,我想利用它。我已经安装了 crypto++(通过在终端中输入 sudo apt-get... 命令),但是由于传统的 ECDH 容易受到中间人攻击。
我想使用完全散列的 menezes-qu-vanstone 协议。虽然它是为 crypto++ 实现的,但它不在主流中,所以我需要修补它。有一个解释 here 但它适用于那些从源代码构建库的人。
有谁知道如何将此补丁应用于从 Ubuntu 存储库安装的 crypto++?我正在使用 Ubuntu 15.
but since traditional ECDH is vulnerable to man-in-the-middle attack.
其他人经常做的是将ECDH与签名方案配对。例如,TLS 使用 ECDH 和类似 RSA 或 ECDSA 的方案。
我不是说你应该这样做;我只是让你知道别人在做什么。
it is not in the main stream so I need to patch it...
我们将在下一个版本中添加 HMQV 和 FHMQV。下一个版本将在接下来的几个月内发布。
Is there anyone who knows how to apply this patch to crypto++ that has been installed from Ubuntu repository?
最简单的方法可能是构建一个新版本的库,然后将其安装到 /usr/local
中。我假设您知道如何下载和修补。构建和安装:
# Crypto++ build directory
...
make static dynamic cryptest.exe
sudo make install PREFIX=/usr/local
您 可能 能够修补 Ubuntu 版本,因为 FHMQV 主要是 header-only 实现。但是,cryptest.exe
不会 包含验证内容。您确实需要为其构建库。
下载补丁并执行以下操作。 fhmqv.h
是补丁的"meat and potatoes"。
sudo cp fhmqv.h /usr/include/cryptopp
您还需要将以下内容添加到 eccrypto.h
。首先打开具有权限的文件(即 sudo emacs /usr/include/cryptopp/eccrypto.h
)。
然后,将此添加到 eccrypto.h
的顶部:
#include "fhmqv.h"
并将此添加到 eccrypto.h
的底部:
//! Fully Hashed Menezes-Qu-Vanstone in GF(p) with key validation,
/*! <a href="http://eprint.iacr.org/2009/408">A Secure and Efficient Authenticated DiffieHellman Protocol</a>
Note: this is FHMQV, Protocol 5, from page 11; and not FHMQV-C.
*/
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption, class HASH = SHA256>
struct FHMQV
{
typedef FHMQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION, HASH> Domain;
};
DIFF 文件中的大部分其他内容都不需要,例如对 wait.h
和 wait.cpp
的更改。添加它是为了解决未解决的错误。这些错误已在 Crypto++ 5.6.3 中清除。
我想将椭圆曲线 Diffie-Hellman (ECDH) 密钥交换协议用于密钥协商过程。它已经在 crypto++ 库中实现,我想利用它。我已经安装了 crypto++(通过在终端中输入 sudo apt-get... 命令),但是由于传统的 ECDH 容易受到中间人攻击。
我想使用完全散列的 menezes-qu-vanstone 协议。虽然它是为 crypto++ 实现的,但它不在主流中,所以我需要修补它。有一个解释 here 但它适用于那些从源代码构建库的人。
有谁知道如何将此补丁应用于从 Ubuntu 存储库安装的 crypto++?我正在使用 Ubuntu 15.
but since traditional ECDH is vulnerable to man-in-the-middle attack.
其他人经常做的是将ECDH与签名方案配对。例如,TLS 使用 ECDH 和类似 RSA 或 ECDSA 的方案。
我不是说你应该这样做;我只是让你知道别人在做什么。
it is not in the main stream so I need to patch it...
我们将在下一个版本中添加 HMQV 和 FHMQV。下一个版本将在接下来的几个月内发布。
Is there anyone who knows how to apply this patch to crypto++ that has been installed from Ubuntu repository?
最简单的方法可能是构建一个新版本的库,然后将其安装到 /usr/local
中。我假设您知道如何下载和修补。构建和安装:
# Crypto++ build directory
...
make static dynamic cryptest.exe
sudo make install PREFIX=/usr/local
您 可能 能够修补 Ubuntu 版本,因为 FHMQV 主要是 header-only 实现。但是,cryptest.exe
不会 包含验证内容。您确实需要为其构建库。
下载补丁并执行以下操作。 fhmqv.h
是补丁的"meat and potatoes"。
sudo cp fhmqv.h /usr/include/cryptopp
您还需要将以下内容添加到 eccrypto.h
。首先打开具有权限的文件(即 sudo emacs /usr/include/cryptopp/eccrypto.h
)。
然后,将此添加到 eccrypto.h
的顶部:
#include "fhmqv.h"
并将此添加到 eccrypto.h
的底部:
//! Fully Hashed Menezes-Qu-Vanstone in GF(p) with key validation,
/*! <a href="http://eprint.iacr.org/2009/408">A Secure and Efficient Authenticated DiffieHellman Protocol</a>
Note: this is FHMQV, Protocol 5, from page 11; and not FHMQV-C.
*/
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption, class HASH = SHA256>
struct FHMQV
{
typedef FHMQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION, HASH> Domain;
};
DIFF 文件中的大部分其他内容都不需要,例如对 wait.h
和 wait.cpp
的更改。添加它是为了解决未解决的错误。这些错误已在 Crypto++ 5.6.3 中清除。