{"id":158980,"date":"2023-02-28T01:35:25","date_gmt":"2023-02-27T17:35:25","guid":{"rendered":"http:\/\/www.idc.net\/help\/158980\/"},"modified":"2023-02-28T01:35:25","modified_gmt":"2023-02-27T17:35:25","slug":"linux%e4%b8%ad%e4%bd%bf%e7%94%a8openssl%e7%9a%84lssl%e5%ba%93%e8%bf%9b%e8%a1%8c%e5%8a%a0%e5%af%86%e8%a7%a3%e5%af%86%e6%93%8d%e4%bd%9c-linux-openssl-lssl","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/158980\/","title":{"rendered":"Linux\u4e2d\u4f7f\u7528OpenSSL\u7684lssl\u5e93\u8fdb\u884c\u52a0\u5bc6\u89e3\u5bc6\u64cd\u4f5c (linux openssl -lssl)"},"content":{"rendered":"<p>\u5728\u65e5\u5e38\u5de5\u4f5c\u4e2d\uff0c\u5b89\u5168\u6027\u8d8a\u6765\u8d8a\u91cd\u8981\uff0c\u7279\u522b\u662f\u5728\u6570\u636e\u4ea4\u6362\u548c\u5b58\u50a8\u65b9\u9762\u3002\u4e3a\u4e86\u4fdd\u62a4\u654f\u611f\u4fe1\u606f\uff0c\u52a0\u5bc6\u548c\u89e3\u5bc6\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u64cd\u4f5c\u3002Linux\u4e2d\u6709\u8bb8\u591a\u52a0\u5bc6\u89e3\u5bc6\u5de5\u5177\uff0c\u5176\u4e2dOpenSSL\u662f\u6700\u4e3a\u5e7f\u6cdb\u4f7f\u7528\u7684\u52a0\u5bc6\u5e93\u4e4b\u4e00\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u4f7f\u7528OpenSSL\u7684lssl\u5e93\u8fdb\u884c\u52a0\u5bc6\u89e3\u5bc6\u64cd\u4f5c\u3002<\/p>\n<p>1. \u5b89\u88c5OpenSSL\u5e93<\/p>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u662f\u6ca1\u6709\u5b89\u88c5OpenSSL\u5e93\u7684\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u9700\u8981\u9996\u5148\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5OpenSSL\u5e93\u3002\u5177\u4f53\u7684\u5b89\u88c5\u6b65\u9aa4\u4f1a\u6839\u636e\u4e0d\u540c\u7684Linux\u53d1\u884c\u7248\u800c\u6709\u6240\u4e0d\u540c\u3002\u4ee5Ubuntu\u4e3a\u4f8b\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u7684\u547d\u4ee4\u6765\u5b89\u88c5OpenSSL\u5e93\uff1a<\/p>\n<p>\u201c`<\/p>\n<p>sudo apt-get install libssl-dev<\/p>\n<p>\u201c`<\/p>\n<p>\u5b89\u88c5\u6210\u529f\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528OpenSSL\u5e93\u7684lssl\u5e93\u8fdb\u884c\u52a0\u5bc6\u89e3\u5bc6\u64cd\u4f5c\u3002<\/p>\n<p>2. \u4f7f\u7528lssl\u5e93\u8fdb\u884c\u52a0\u5bc6\u89e3\u5bc6\u64cd\u4f5c<\/p>\n<p>lssl\u662fOpenSSL\u5e93\u7684\u4e00\u4e2a\u5b50\u96c6\uff0c\u5b83\u5305\u542b\u4e86\u52a0\u5bc6\u3001\u89e3\u5bc6\u3001\u7b7e\u540d\u548c\u9a8c\u8bc1\u7b49\u529f\u80fd\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u9010\u6b65\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528lssl\u5e93\u8fdb\u884c\u52a0\u5bc6\u89e3\u5bc6\u64cd\u4f5c\u3002<\/p>\n<p>\u5728\u4f7f\u7528lssl\u5e93\u4e4b\u524d\uff0c\u6211\u4eec\u9996\u5148\u9700\u8981\u5f15\u5165lssl\u5e93\u7684\u5934\u6587\u4ef6\u548c\u5b9a\u4e49\u4e00\u4e9b\u53d8\u91cf\u548c\u5b8f\u3002\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p>\u201c`c<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#define AES_BLOCK_SIZE 16<\/p>\n<p>\u201c`<\/p>\n<p>\u4ee5\u4e0a\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u5f15\u5165\u4e86AES\u52a0\u5bc6\u76f8\u5173\u7684\u5934\u6587\u4ef6\u53ca\u76f8\u5173\u7684\u5b8f\u5b9a\u4e49\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u9010\u6b65\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528lssl\u5e93\u8fdb\u884c\u52a0\u5bc6\u89e3\u5bc6\u64cd\u4f5c\u3002<\/p>\n<p>2.1 AES\u52a0\u5bc6<\/p>\n<p>AES\u52a0\u5bc6\u662f\u5e38\u89c1\u7684\u52a0\u5bc6\u7b97\u6cd5\u4e4b\u4e00\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528lssl\u5e93\u8fdb\u884cAES\u52a0\u5bc6\u64cd\u4f5c\u3002<\/p>\n<p>\u201c`c<\/p>\n<p>void aes_encrypt(unsigned char *plntext, int plntext_len, unsigned char *key,<\/p>\n<p> unsigned char *iv, unsigned char *ciphertext)<\/p>\n<p>{<\/p>\n<p> EVP_CIPHER_CTX *ctx;<\/p>\n<p> int len;<\/p>\n<p> int ciphertext_len;<\/p>\n<p> \/* \u521b\u5efa\u5e76\u521d\u59cb\u5316EVP_CIPHER_CTX *\/<\/p>\n<p> if (!(ctx = EVP_CIPHER_CTX_new()))<\/p>\n<p> handleErrors();<\/p>\n<p> \/* \u521d\u59cb\u5316\u52a0\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))<\/p>\n<p> handleErrors();<\/p>\n<p> \/* \u6267\u884c\u52a0\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_EncryptUpdate(ctx, ciphertext, &amp;len, plntext, plntext_len))<\/p>\n<p> handleErrors();<\/p>\n<p> ciphertext_len = len;<\/p>\n<p> \/* \u7ed3\u675f\u52a0\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &amp;len))<\/p>\n<p> handleErrors();<\/p>\n<p> ciphertext_len += len;<\/p>\n<p> \/* \u91ca\u653eEVP_CIPHER_CTX *\/<\/p>\n<p> EVP_CIPHER_CTX_free(ctx);<\/p>\n<p>}<\/p>\n<p>\u201c`<\/p>\n<p>\u4ee5\u4e0a\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86EVP_CIPHER_CTX\u6765\u7ba1\u7406\u52a0\u5bc6\u4e0a\u4e0b\u6587\uff0c\u5e76\u521d\u59cb\u5316\u4e86\u52a0\u5bc6\u64cd\u4f5c\u3002\u63a5\u7740\uff0c\u6211\u4eec\u8c03\u7528EVP_EncryptUpdate\u51fd\u6570\u4ece\u660e\u6587\u4e2d\u8bfb\u53d6\u6570\u636e\uff0c\u5e76\u8c03\u7528EVP_EncryptFinal_ex\u51fd\u6570\u5b8c\u6210\u52a0\u5bc6\u64cd\u4f5c\u3002\u6211\u4eec\u91ca\u653e\u4e86EVP_CIPHER_CTX\u3002<\/p>\n<p>2.2 AES\u89e3\u5bc6<\/p>\n<p>\u89e3\u5bc6\u64cd\u4f5c\u4e0e\u52a0\u5bc6\u64cd\u4f5c\u7c7b\u4f3c\uff0c\u53ea\u662f\u8c03\u7528\u7684\u51fd\u6570\u7a0d\u6709\u4e0d\u540c\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528lssl\u5e93\u8fdb\u884cAES\u89e3\u5bc6\u64cd\u4f5c\u3002<\/p>\n<p>\u201c`c<\/p>\n<p>void aes_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key,<\/p>\n<p> unsigned char *iv, unsigned char *plntext)<\/p>\n<p>{<\/p>\n<p> EVP_CIPHER_CTX *ctx;<\/p>\n<p> int len;<\/p>\n<p> int plntext_len;<\/p>\n<p> \/* \u521b\u5efa\u5e76\u521d\u59cb\u5316EVP_CIPHER_CTX *\/<\/p>\n<p> if (!(ctx = EVP_CIPHER_CTX_new()))<\/p>\n<p> handleErrors();<\/p>\n<p> \/* \u521d\u59cb\u5316\u89e3\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))<\/p>\n<p> handleErrors();<\/p>\n<p> \/* \u6267\u884c\u89e3\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_DecryptUpdate(ctx, plntext, &amp;len, ciphertext, ciphertext_len))<\/p>\n<p> handleErrors();<\/p>\n<p> plntext_len = len;<\/p>\n<p> \/* \u7ed3\u675f\u89e3\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_DecryptFinal_ex(ctx, plntext + len, &amp;len))<\/p>\n<p> handleErrors();<\/p>\n<p> plntext_len += len;<\/p>\n<p> \/* \u91ca\u653eEVP_CIPHER_CTX *\/<\/p>\n<p> EVP_CIPHER_CTX_free(ctx);<\/p>\n<p>}<\/p>\n<p>\u201c`<\/p>\n<p>\u4ee5\u4e0a\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u521b\u5efa\u5e76\u521d\u59cb\u5316\u4e86EVP_CIPHER_CTX\u3002\u63a5\u7740\uff0c\u6211\u4eec\u521d\u59cb\u5316\u4e86\u89e3\u5bc6\u64cd\u4f5c\u5e76\u8c03\u7528EVP_DecryptUpdate\u51fd\u6570\u4ece\u5bc6\u6587\u4e2d\u8bfb\u53d6\u6570\u636e\u3002\u6211\u4eec\u91ca\u653eEVP_CIPHER_CTX\u3002<\/p>\n<p>3. \u793a\u4f8b\u7a0b\u5e8f<\/p>\n<p>\u4e3a\u4e86\u6f14\u793alssl\u5e93\u7684\u52a0\u5bc6\u89e3\u5bc6\u64cd\u4f5c\uff0c\u6211\u4eec\u7f16\u5199\u4e86\u4ee5\u4e0b\u793a\u4f8b\u7a0b\u5e8f\uff1a<\/p>\n<p>\u201c`c<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#include <\/p>\n<\/p>\n<p>#define AES_BLOCK_SIZE 16<\/p>\n<p>void handleErrors(void)<\/p>\n<p>{<\/p>\n<p> fprintf(stderr, \u201cError\\n\u201d);<\/p>\n<p> abort();<\/p>\n<p>}<\/p>\n<p>void aes_encrypt(unsigned char *plntext, int plntext_len, unsigned char *key,<\/p>\n<p> unsigned char *iv, unsigned char *ciphertext)<\/p>\n<p>{<\/p>\n<p> EVP_CIPHER_CTX *ctx;<\/p>\n<p> int len;<\/p>\n<p> int ciphertext_len;<\/p>\n<p> \/* \u521b\u5efa\u5e76\u521d\u59cb\u5316EVP_CIPHER_CTX *\/<\/p>\n<p> if (!(ctx = EVP_CIPHER_CTX_new()))<\/p>\n<p> handleErrors();<\/p>\n<p> \/* \u521d\u59cb\u5316\u52a0\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))<\/p>\n<p> handleErrors();<\/p>\n<p> \/* \u6267\u884c\u52a0\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_EncryptUpdate(ctx, ciphertext, &amp;len, plntext, plntext_len))<\/p>\n<p> handleErrors();<\/p>\n<p> ciphertext_len = len;<\/p>\n<p> \/* \u7ed3\u675f\u52a0\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &amp;len))<\/p>\n<p> handleErrors();<\/p>\n<p> ciphertext_len += len;<\/p>\n<p> \/* \u91ca\u653eEVP_CIPHER_CTX *\/<\/p>\n<p> EVP_CIPHER_CTX_free(ctx);<\/p>\n<p>}<\/p>\n<p>void aes_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key,<\/p>\n<p> unsigned char *iv, unsigned char *plntext)<\/p>\n<p>{<\/p>\n<p> EVP_CIPHER_CTX *ctx;<\/p>\n<p> int len;<\/p>\n<p> int plntext_len;<\/p>\n<p> \/* \u521b\u5efa\u5e76\u521d\u59cb\u5316EVP_CIPHER_CTX *\/<\/p>\n<p> if (!(ctx = EVP_CIPHER_CTX_new()))<\/p>\n<p> handleErrors();<\/p>\n<p> \/* \u521d\u59cb\u5316\u89e3\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))<\/p>\n<p> handleErrors();<\/p>\n<p> \/* \u6267\u884c\u89e3\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_DecryptUpdate(ctx, plntext, &amp;len, ciphertext, ciphertext_len))<\/p>\n<p> handleErrors();<\/p>\n<p> plntext_len = len;<\/p>\n<p> \/* \u7ed3\u675f\u89e3\u5bc6\u64cd\u4f5c *\/<\/p>\n<p> if (1 != EVP_DecryptFinal_ex(ctx, plntext + len, &amp;len))<\/p>\n<p> handleErrors();<\/p>\n<p> plntext_len += len;<\/p>\n<p> \/* \u91ca\u653eEVP_CIPHER_CTX *\/<\/p>\n<p> EVP_CIPHER_CTX_free(ctx);<\/p>\n<p>}<\/p>\n<p>void print_hex(unsigned char *data, int len)<\/p>\n<p>{<\/p>\n<p> for (int i = 0; i <\/p>\n<p> printf(\u201c%02x\u201d, data[i]);<\/p>\n<p> }<\/p>\n<p> printf(\u201c\\n\u201d);<\/p>\n<p>}<\/p>\n<p>int mn()<\/p>\n<p>{<\/p>\n<p> unsigned char plntext[] = \u201cOpenSSL-lssl-example\u201d;<\/p>\n<p> unsigned char key[AES_BLOCK_SIZE], iv[AES_BLOCK_SIZE];<\/p>\n<p> unsigned char ciphertext[sizeof(plntext)];<\/p>\n<p> unsigned char decryptedtext[sizeof(plntext)];<\/p>\n<p> int decryptedtext_len, ciphertext_len;<\/p>\n<p> \/* \u751f\u6210\u968f\u673aKEY\u548cIV *\/<\/p>\n<p> RAND_bytes(key, AES_BLOCK_SIZE);<\/p>\n<p> RAND_bytes(iv, AES_BLOCK_SIZE);<\/p>\n<p> printf(\u201cPlntext: %s\\n\u201d, plntext);<\/p>\n<p> \/* \u52a0\u5bc6 *\/<\/p>\n<p> aes_encrypt(plntext, strlen((char *) plntext), key, iv, ciphertext);<\/p>\n<p> printf(\u201cCiphertext: \u201c);<\/p>\n<p> print_hex(ciphertext, sizeof(ciphertext));<\/p>\n<p> \/* \u89e3\u5bc6 *\/<\/p>\n<p> aes_decrypt(ciphertext, sizeof(ciphertext), key, iv, decryptedtext);<\/p>\n<p> \/* \u53d6\u51fa\u89e3\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\uff0c\u9700\u8981\u672b\u5c3e\u52a0\u4e0a\u2019\\0\u2019\u624d\u80fd\u6253\u5370\u51fa\u6765 *\/<\/p>\n<p> decryptedtext_len = sizeof(decryptedtext);<\/p>\n<p> decryptedtext[decryptedtext_len] = \u2018\\0\u2019;<\/p>\n<p> printf(\u201cDecrypted text: %s\\n\u201d, decryptedtext);<\/p>\n<p> return 0;<\/p>\n<p>}<\/p>\n<p>\u201c`<\/p>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u751f\u6210\u4e86\u968f\u673a\u7684KEY\u548cIV\uff0c\u7136\u540e\u4f7f\u7528KEY\u548cIV\u5bf9\u660e\u6587\u52a0\u5bc6\uff0c\u6700\u540e\u5bf9\u5bc6\u6587\u8fdb\u884c\u89e3\u5bc6\uff0c\u5e76\u8f93\u51fa\u89e3\u5bc6\u540e\u7684\u660e\u6587\u3002<\/p>\n<p><strong>\u76f8\u5173\u95ee\u9898\u62d3\u5c55\u9605\u8bfb\uff1a<\/strong><\/p>\n<ul>\n<li>linux\u4e0b\u7684eclipse\u600e\u6837\u4f7f\u7528openssl<\/li>\n<li>linux\u4e0b\u5982\u4f55\u5b89\u88c5openssl\u5305<\/li>\n<\/ul>\n<h3>linux\u4e0b\u7684eclipse\u600e\u6837\u4f7f\u7528openssl<\/h3>\n<p>\u4e00\u3001\u5b89\u88c5<\/p>\n<p>\u9996\u5148\u4e0b\u8f7dopenssL\u7684\u539f\u59cb\u6587\u4ef6\u5305\uff0c\u4f8b\u5982openssl-1.0.1f.tar.gz<\/p>\n<p>\u5c06\u8be5\u6587\u4ef6\u590d\u5236\u5230\u5de5\u4f5c\u533a\u76ee\u5f55\u4e0b\uff0c\u4e00\u822c\u662f\/home\u4e0b\u7684\u4e2a\u4eba\u6587\u4ef6\u5939<\/p>\n<p>\u89e3\u538b\u6587\u4ef6tar zxvf openssl-1.0.1f.tar.gz<\/p>\n<p>\u8fdb\u5165\u6587\u4ef6\u5185 cd openssl-1.0.1f<\/p>\n<p>\u914d\u7f6e\uff0c\u5c06\u751f\u6210\u7684openssL\u6587\u4ef6\u590d\u5236\u5230\u7cfb\u7edf\u9ed8\u8ba4\u7684\u6587\u4ef6\u5939\u4e0b\uff0c\u8be5\u6b65\u9aa4\u53ea\u8981\u590d\u5236\u4e0b\u9762\u7684\u4ee3\u7801\u5c31\u53ef\u4ee5\u4e86\uff1a\u201d.\/config \u2013prefix=\/usr\/local\/openssl shared\u201d<\/p>\n<p>\u6267\u884cmake\u547d\u4ee4\uff1amake<\/p>\n<p>\u4f7f\u7528root\u6743\u9650\uff0c\u5b89\u88c5openssL\uff1asudo make install<\/p>\n<p>\u81f3\u6b64\uff0copenssL\u5b89\u88c5\u5b8c\u6210\u3002\u5b8c\u6210\u7684\u76ee\u5f55\u4e2d\u6709\u4e24\u4e2a\u6bd4\u8f83\u91cd\u8981\uff0c\u4e00\u4e2a\u662finclude\u5305\uff0c\u91cc\u9762\u90fd\u662f\u5916\u90e8\u8c03\u7528\u65f6\u53ef\u4ee5\u67e5\u9605\u7684.h\u5934\u6587\u4ef6\uff0c\u53e6\u4e00\u4e2a\u662flib\u5305\uff0c\u91cc\u9762\u6709ssl\u548ccrypto\u7684\u9759\u6001\u548c\u5171\u4eab\u6587\u4ef6\u5305\u3002\u7b2c\u4e8c\u6b65\u7684\u914d\u7f6e\uff0c\u4e3b\u8001\u78b0\u8981\u662f\u914d\u7f6e\u8fd9\u4e24\u4e2a\u6587\u4ef6\u3002<\/p>\n<p>\u4e8c\u3001\u5728eclipse\u4e2d\u914d\u7f6e\u7684\u65b9\u6cd5<\/p>\n<p>\u5728eclipse\u4e2d\u5fc5\u987b\u914d\u7f6einclude\u548clib\u4e24\u4e2a\u53d8\u91cf\u3002<\/p>\n<p>\u65b0\u5efa\u4e00\u4e2aC\u8bed\u8a00\u6d4b\u8bd5\u5de5\u7a0b\uff0c\u4f8b\u5982openssL_test\uff0c\u53f3\u952e-\u5c5e\u6027-C\/C++ Build-\u8bbe\u7f6e\uff0c\u7136\u540e\u5355\u51fb\u56fe\u4e2d\u53f3\u4fa7\u4e4b\u4e00\u4e2a\u7ea2\u6846\uff0c\u4e5f\u5c31\u662fGCC C Compiler \u4e0b\u7684include\uff0c\u505a\u5982\u4e0b\u8bbe\u7f6e\uff0c\u8fd9\u91cc\u7684path\u5c31\u662f\u4e0a\u9762include\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>OpenSSL\u5728Linux Eclipse\u4e0b\u4f7f\u7528\u7684\u5b8c\u6574\u8fc7\u7a0b-\u9644\u622a\u56fe\u548c\u6d4b\u8bd5\u7a0b\u5e8f<\/p>\n<p>\u7136\u540e\u5355\u51fbGCC C Linker \u4e0b\u7684libraries \uff0c\u505a\u6167\u95f9\u5982\u4e0b\u8bbe\u7f6e\uff1a<\/p>\n<p>OpenSSL\u5728Linux Eclipse\u4e0b\u4f7f\u7528\u7684\u5b8c\u6574\u8fc7\u7a0b-\u9644\u622a\u56fe\u548c\u6d4b\u8bd5\u7a0b\u5e8f<\/p>\n<p>ssl\u548ccrypto\u662f\u7528\u6237\u624b\u52a8\u52a0\u4e0a\u53bb\u7684\uff0c\u4f46\u4e0d\u662f\u968f\u610f\u5199\u7684\uff0c\u5176\u5b9e\u8fd9\u4e24\u4e2a\u53d8\u91cf\u5bf9\u5e94\u7740\/usr\/local\/openssl\/lib\u76ee\u5f55\u4e0b\u7684libssl.so\u548clibcrypto.so\u6587\u4ef6\u3002<\/p>\n<p>\u53e6\u5916\u8981\u6ce8\u610f\uff0c\u5982\u679c\u5efa\u7684\u5de5\u7a0b\u4e3aC++\u7c7b\u578b\uff0c\u4e0a\u56fe\u4e2d\u8fd8\u4f1a\u6709\u4e00\u4e2aG++\u7684\u7f16\u8bd1\u5668\u8bbe\u7f6e\u9009\u9879\uff0c\u8bbe\u7f6e\u65b9\u5f0f\u4e0eGCC\u7684\u4e00\u524d\u542b\u7f69\u6837\u5c31\u53ef\u4ee5\u3002<\/p>\n<h3>linux\u4e0b\u5982\u4f55\u5b89\u88c5openssl\u5305<\/h3>\n<p>1.\u89e3\u538bopenssl-0.9.8k.tar.gz2.\u4ece\u7ec8\u7aef\uff08\u547d\u4ee4\u884c\uff09\u8fdb\u5165\u89e3\u538b\u51fa\u6765\u7684\u76ee\u5f55openssl-0.9.8k\u4e0b\uff0c\u5728\u547d\u4ee4\u884c\u6267\u884c.\/config \u2013prefix=\/usr3.\u6267\u884cmake4.\u6267\u884csudo make install\u5b89\u88c5\u5b8c\u5146\u5907\u71c3\u770b\u770busr\/include\u76ee\u5f55\u4e0b\u6709\u6ca1\u6709openssl\u6587\u4ef6\u5939\uff0c\u6709\u5c31\u5b89\u88c5\u5b8c\u6210\uff0c\u65cf\u865a\u53ef\u4ee5\u76f4\u63a5\u5f15\u7528\u6eda\u7741\u91cc\u9762\u7684md5.h\u4e86<\/p>\n<p>\u5173\u4e8elinux openssl -lssl\u7684\u4ecb\u7ecd\u5230\u6b64\u5c31\u7ed3\u675f\u4e86\uff0c\u4e0d\u77e5\u9053\u4f60\u4ece\u4e2d\u627e\u5230\u4f60\u9700\u8981\u7684\u4fe1\u606f\u4e86\u5417 \uff1f\u5982\u679c\u4f60\u8fd8\u60f3\u4e86\u89e3\u66f4\u591a\u8fd9\u65b9\u9762\u7684\u4fe1\u606f\uff0c\u8bb0\u5f97\u6536\u85cf\u5173\u6ce8\u672c\u7ad9\u3002<\/p>\n<p><a href=\"http:https:\/\/idc.net\/\">\u9999\u6e2f\u670d\u52a1\u5668<\/a>\u9996\u9009\u540e\u6d6a\u4e91\uff0c2H2G\u9996\u670810\u5143\u5f00\u901a\u3002<br \/>\u540e\u6d6a\u4e91\uff08www.IDC.Net\uff09\u63d0\u4f9b\u7b80\u5355\u597d\u7528\uff0c\u4ef7\u683c\u539a\u9053\u7684\u9999\u6e2f\/\u7f8e\u56fd\u4e91\u670d\u52a1\u5668\u548c\u72ec\u7acb\u670d\u52a1\u5668\u3002IDC+ISP+ICP\u8d44\u8d28\u3002ARIN\u548cAPNIC\u4f1a\u5458\u3002\u6210\u719f\u6280\u672f\u56e2\u961f15\u5e74\u884c\u4e1a\u7ecf\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u65e5\u5e38\u5de5\u4f5c\u4e2d\uff0c\u5b89\u5168\u6027\u8d8a\u6765\u8d8a\u91cd\u8981\uff0c\u7279\u522b\u662f\u5728\u6570\u636e\u4ea4\u6362\u548c\u5b58\u50a8\u65b9\u9762\u3002\u4e3a\u4e86\u4fdd\u62a4\u654f\u611f\u4fe1\u606f\uff0c\u52a0\u5bc6\u548c\u89e3\u5bc6\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u64cd\u4f5c\u3002Li [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-158980","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/158980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=158980"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/158980\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=158980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=158980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=158980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}