我有一堆服务器在docker-for-windows的docker容器中运行.由于docker如何在windows上工作,所以这些都被推入hyper-v vm内部,然后容器在那里运行.因此,要访问绑定到localhost的服务器,我实际上使用的是hyper-v虚拟适配器的ip.
因此,当我在主机Windows机器上时,我可以使用10.0.75.2:3579连接到我的服务器.现在我想用zerotier将我的所有docker容器桥接到一个虚拟局域网,这样我就可以在学校网络之外访问我的容器了.ZeroTier创建一个名为"zerotier one virtual port"的虚拟适配器:
现在的工作原理是,如果我在主机Windows机器上运行服务器(裸机),那么我可以使用我的zerotier ip 10.147.17.221:port访问它们.但这并没有连接我的docker东西,因为它在不同的适配器上,这意味着我必须在机器上进行任何与docker相关的东西.如何将zerotier适配器路由或桥接到hyper-v docker适配器,以便我可以使用zerotier ip从外部访问我的docker容器?
经过几天的互联网搜索和openssl文档,我已经碰壁了.我正在尝试使用私钥对邮件进行签名,然后使用公钥验证邮件的真实性.
密钥生成代码:
//Generate RSA Keys
EVP_PKEY_CTX* KeyCtx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
if (KeyCtx == nullptr)
return false;
if (EVP_PKEY_keygen_init(KeyCtx) <= 0)
return false;
if (EVP_PKEY_CTX_set_rsa_keygen_bits(KeyCtx, RSA_KeyLen) <= 0)
return false;
if (EVP_PKEY_keygen(KeyCtx, &m_ServerKeyPair) <= 0)
return false;
if (EVP_PKEY_keygen(KeyCtx, &m_ClientKeyPair) <= 0)
return false;
//Write Keys to EVP_PKEYS for actual internal encryption,BIO mem is wiped after read so we need a new copy
PEM_read_bio_PrivateKey(KeyToPrivBio(m_ServerKeyPair), &m_ServerPrivateKey, NULL, NULL);
PEM_read_bio_PUBKEY(KeyToPubBio(m_ServerKeyPair), &m_ServerPublicKey, NULL, NULL);
PEM_read_bio_PrivateKey(KeyToPrivBio(m_ClientKeyPair), &m_ClientPrivateKey, NULL, NULL);
PEM_read_bio_PUBKEY(KeyToPubBio(m_ClientKeyPair), &m_ClientPublicKey, NULL, NULL);
Run Code Online (Sandbox Code Playgroud)
RSA标志:
bool …Run Code Online (Sandbox Code Playgroud)