{"id":1132521,"date":"2025-01-08T20:58:07","date_gmt":"2025-01-08T12:58:07","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1132521.html"},"modified":"2025-01-08T20:58:10","modified_gmt":"2025-01-08T12:58:10","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e5%ae%9e%e7%8e%b0%e5%8a%a0%e8%a7%a3%e5%af%86%e6%96%87%e6%9c%ac%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1132521.html","title":{"rendered":"\u5982\u4f55\u7528python\u5b9e\u73b0\u52a0\u89e3\u5bc6\u6587\u672c\u6587\u4ef6"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25102037\/89c51de2-55e6-425d-8a7f-b88b9a1caffa.webp\" alt=\"\u5982\u4f55\u7528python\u5b9e\u73b0\u52a0\u89e3\u5bc6\u6587\u672c\u6587\u4ef6\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u7528Python\u5b9e\u73b0\u52a0\u89e3\u5bc6\u6587\u672c\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528Python\u5b9e\u73b0\u52a0\u89e3\u5bc6\u6587\u672c\u6587\u4ef6\u7684\u65b9\u6cd5\u6709\u591a\u79cd<\/strong>\uff0c\u5982<strong>\u5bf9\u79f0\u52a0\u5bc6\u3001\u975e\u5bf9\u79f0\u52a0\u5bc6\u3001\u54c8\u5e0c\u52a0\u5bc6<\/strong>\u7b49\u3002<strong>\u5bf9\u79f0\u52a0\u5bc6<\/strong>\u662f\u6700\u5e38\u89c1\u7684\u52a0\u5bc6\u65b9\u5f0f\uff0c\u5b83\u4f7f\u7528\u76f8\u540c\u7684\u5bc6\u94a5\u8fdb\u884c\u52a0\u5bc6\u548c\u89e3\u5bc6\u3002\u6211\u4eec\u5c06\u5728\u672c\u6587\u4e2d\u8be6\u7ec6\u8ba8\u8bba\u5bf9\u79f0\u52a0\u5bc6\u7b97\u6cd5\u7684\u5b9e\u73b0\u7ec6\u8282\uff0c\u5c24\u5176\u662fAES\uff08\u9ad8\u7ea7\u52a0\u5bc6\u6807\u51c6\uff09\u7b97\u6cd5\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u5bf9\u79f0\u52a0\u5bc6\u7b97\u6cd5<\/h2>\n<\/p>\n<p><h3>1.1 \u4ec0\u4e48\u662f\u5bf9\u79f0\u52a0\u5bc6<\/h3>\n<\/p>\n<p><p>\u5bf9\u79f0\u52a0\u5bc6\u662f\u4e00\u79cd\u52a0\u5bc6\u6280\u672f\uff0c\u5176\u4e2d\u52a0\u5bc6\u548c\u89e3\u5bc6\u90fd\u4f7f\u7528\u76f8\u540c\u7684\u5bc6\u94a5\u3002AES\uff08\u9ad8\u7ea7\u52a0\u5bc6\u6807\u51c6\uff09\u662f\u6700\u5e38\u7528\u7684\u5bf9\u79f0\u52a0\u5bc6\u7b97\u6cd5\u4e4b\u4e00\u3002\u5b83\u4ee5\u5176\u9ad8\u6548\u548c\u5b89\u5168\u6027\u800c\u95fb\u540d\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5404\u79cd\u573a\u666f\u3002<\/p>\n<\/p>\n<p><h3>1.2 \u4f7f\u7528Python\u7684\u5e93<\/h3>\n<\/p>\n<p><p>Python\u4e2d\u6709\u591a\u4e2a\u5e93\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u79f0\u52a0\u5bc6\uff0c\u5982<code>PyCryptodome<\/code>\u548c<code>cryptography<\/code>\u3002\u6211\u4eec\u5c06\u91cd\u70b9\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528<code>PyCryptodome<\/code>\u5e93\u6765\u5b9e\u73b0AES\u52a0\u5bc6\u3002<\/p>\n<\/p>\n<p><h3>1.3 \u5b89\u88c5PyCryptodome<\/h3>\n<\/p>\n<p><p>\u8981\u4f7f\u7528<code>PyCryptodome<\/code>\u5e93\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5b83\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install pycryptodome<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e8c\u3001AES\u52a0\u5bc6\u7684\u5177\u4f53\u5b9e\u73b0<\/h2>\n<\/p>\n<p><h3>2.1 \u52a0\u5bc6\u6d41\u7a0b<\/h3>\n<\/p>\n<p><p>\u5728AES\u52a0\u5bc6\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u5bc6\u94a5\u548c\u4e00\u4e2a\u521d\u59cb\u5411\u91cf\uff08IV\uff09\u3002\u5bc6\u94a5\u7684\u957f\u5ea6\u53ef\u4ee5\u662f16\u5b57\u8282\u300124\u5b57\u8282\u621632\u5b57\u8282\uff0c\u800cIV\u7684\u957f\u5ea6\u56fa\u5b9a\u4e3a16\u5b57\u8282\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from Crypto.Cipher import AES<\/p>\n<p>from Crypto.Random import get_random_bytes<\/p>\n<p>import base64<\/p>\n<p>def encrypt(pl<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n_text, key):<\/p>\n<p>    cipher = AES.new(key, AES.MODE_CFB)<\/p>\n<p>    iv = cipher.iv<\/p>\n<p>    encrypted_text = cipher.encrypt(plain_text.encode(&#39;utf-8&#39;))<\/p>\n<p>    return base64.b64encode(iv + encrypted_text).decode(&#39;utf-8&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2.2 \u89e3\u5bc6\u6d41\u7a0b<\/h3>\n<\/p>\n<p><p>\u89e3\u5bc6\u8fc7\u7a0b\u9700\u8981\u4f7f\u7528\u76f8\u540c\u7684\u5bc6\u94a5\u548cIV\u3002\u6211\u4eec\u9996\u5148\u4ece\u52a0\u5bc6\u7684\u6587\u672c\u4e2d\u63d0\u53d6IV\uff0c\u7136\u540e\u4f7f\u7528\u5b83\u8fdb\u884c\u89e3\u5bc6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def decrypt(encrypted_text, key):<\/p>\n<p>    encrypted_text_bytes = base64.b64decode(encrypted_text)<\/p>\n<p>    iv = encrypted_text_bytes[:16]<\/p>\n<p>    encrypted_text_bytes = encrypted_text_bytes[16:]<\/p>\n<p>    cipher = AES.new(key, AES.MODE_CFB, iv=iv)<\/p>\n<p>    decrypted_text = cipher.decrypt(encrypted_text_bytes)<\/p>\n<p>    return decrypted_text.decode(&#39;utf-8&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e09\u3001\u975e\u5bf9\u79f0\u52a0\u5bc6\u7b97\u6cd5<\/h2>\n<\/p>\n<p><h3>3.1 \u4ec0\u4e48\u662f\u975e\u5bf9\u79f0\u52a0\u5bc6<\/h3>\n<\/p>\n<p><p>\u975e\u5bf9\u79f0\u52a0\u5bc6\u4f7f\u7528\u4e00\u5bf9\u5bc6\u94a5\uff1a\u516c\u94a5\u548c\u79c1\u94a5\u3002\u516c\u94a5\u7528\u4e8e\u52a0\u5bc6\uff0c\u79c1\u94a5\u7528\u4e8e\u89e3\u5bc6\u3002RSA\uff08Rivest-Shamir-Adleman\uff09\u662f\u6700\u5e38\u7528\u7684\u975e\u5bf9\u79f0\u52a0\u5bc6\u7b97\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>3.2 \u4f7f\u7528Python\u7684\u5e93<\/h3>\n<\/p>\n<p><p>Python\u7684<code>cryptography<\/code>\u5e93\u53ef\u4ee5\u65b9\u4fbf\u5730\u5b9e\u73b0RSA\u52a0\u5bc6\u3002<\/p>\n<\/p>\n<p><h3>3.3 \u5b89\u88c5cryptography<\/h3>\n<\/p>\n<p><p>\u8981\u4f7f\u7528<code>cryptography<\/code>\u5e93\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5b83\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install cryptography<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3.4 \u52a0\u5bc6\u6d41\u7a0b<\/h3>\n<\/p>\n<p><p>\u5728RSA\u52a0\u5bc6\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u751f\u6210\u4e00\u5bf9\u5bc6\u94a5\uff0c\u7136\u540e\u4f7f\u7528\u516c\u94a5\u8fdb\u884c\u52a0\u5bc6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from cryptography.hazmat.primitives.asymmetric import rsa<\/p>\n<p>from cryptography.hazmat.primitives.asymmetric import padding<\/p>\n<p>from cryptography.hazmat.primitives import hashes<\/p>\n<p>from cryptography.hazmat.primitives import serialization<\/p>\n<h2><strong>\u751f\u6210\u5bc6\u94a5\u5bf9<\/strong><\/h2>\n<p>private_key = rsa.generate_private_key(<\/p>\n<p>    public_exponent=65537,<\/p>\n<p>    key_size=2048,<\/p>\n<p>)<\/p>\n<p>public_key = private_key.public_key()<\/p>\n<h2><strong>\u5e8f\u5217\u5316\u516c\u94a5<\/strong><\/h2>\n<p>public_pem = public_key.public_bytes(<\/p>\n<p>    encoding=serialization.Encoding.PEM,<\/p>\n<p>    format=serialization.PublicFormat.SubjectPublicKeyInfo<\/p>\n<p>)<\/p>\n<p>def rsa_encrypt(plain_text, public_key):<\/p>\n<p>    encrypted_text = public_key.encrypt(<\/p>\n<p>        plain_text.encode(&#39;utf-8&#39;),<\/p>\n<p>        padding.OAEP(<\/p>\n<p>            mgf=padding.MGF1(algorithm=hashes.SHA256()),<\/p>\n<p>            algorithm=hashes.SHA256(),<\/p>\n<p>            label=None<\/p>\n<p>        )<\/p>\n<p>    )<\/p>\n<p>    return base64.b64encode(encrypted_text).decode(&#39;utf-8&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3.5 \u89e3\u5bc6\u6d41\u7a0b<\/h3>\n<\/p>\n<p><p>\u89e3\u5bc6\u8fc7\u7a0b\u9700\u8981\u4f7f\u7528\u79c1\u94a5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5e8f\u5217\u5316\u79c1\u94a5<\/p>\n<p>private_pem = private_key.private_bytes(<\/p>\n<p>    encoding=serialization.Encoding.PEM,<\/p>\n<p>    format=serialization.PrivateFormat.TraditionalOpenSSL,<\/p>\n<p>    encryption_algorithm=serialization.NoEncryption()<\/p>\n<p>)<\/p>\n<p>def rsa_decrypt(encrypted_text, private_key):<\/p>\n<p>    encrypted_text_bytes = base64.b64decode(encrypted_text)<\/p>\n<p>    decrypted_text = private_key.decrypt(<\/p>\n<p>        encrypted_text_bytes,<\/p>\n<p>        padding.OAEP(<\/p>\n<p>            mgf=padding.MGF1(algorithm=hashes.SHA256()),<\/p>\n<p>            algorithm=hashes.SHA256(),<\/p>\n<p>            label=None<\/p>\n<p>        )<\/p>\n<p>    )<\/p>\n<p>    return decrypted_text.decode(&#39;utf-8&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u56db\u3001\u54c8\u5e0c\u52a0\u5bc6<\/h2>\n<\/p>\n<p><h3>4.1 \u4ec0\u4e48\u662f\u54c8\u5e0c\u52a0\u5bc6<\/h3>\n<\/p>\n<p><p>\u54c8\u5e0c\u52a0\u5bc6\u662f\u4e00\u79cd\u5355\u5411\u52a0\u5bc6\u6280\u672f\uff0c\u5e7f\u6cdb\u7528\u4e8e\u6570\u636e\u5b8c\u6574\u6027\u9a8c\u8bc1\u3002\u5e38\u89c1\u7684\u54c8\u5e0c\u7b97\u6cd5\u6709SHA-256\u3001MD5\u7b49\u3002<\/p>\n<\/p>\n<p><h3>4.2 \u4f7f\u7528Python\u7684\u5e93<\/h3>\n<\/p>\n<p><p>Python\u7684<code>hashlib<\/code>\u5e93\u63d0\u4f9b\u4e86\u591a\u79cd\u54c8\u5e0c\u7b97\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>4.3 \u54c8\u5e0c\u52a0\u5bc6\u5b9e\u73b0<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import hashlib<\/p>\n<p>def hash_text(text):<\/p>\n<p>    sha256_hash = hashlib.sha256()<\/p>\n<p>    sha256_hash.update(text.encode(&#39;utf-8&#39;))<\/p>\n<p>    return sha256_hash.hexdigest()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>4.4 \u54c8\u5e0c\u9a8c\u8bc1<\/h3>\n<\/p>\n<p><p>\u54c8\u5e0c\u9a8c\u8bc1\u901a\u8fc7\u6bd4\u8f83\u4e24\u4e2a\u54c8\u5e0c\u503c\u662f\u5426\u76f8\u540c\u6765\u786e\u8ba4\u6570\u636e\u5b8c\u6574\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def verify_hash(text, hash_value):<\/p>\n<p>    return hash_text(text) == hash_value<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e94\u3001\u7efc\u5408\u793a\u4f8b<\/h2>\n<\/p>\n<p><h3>5.1 \u52a0\u5bc6\u548c\u89e3\u5bc6\u6587\u672c\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528\u4e0a\u8ff0\u52a0\u5bc6\u6280\u672f\u6765\u52a0\u5bc6\u548c\u89e3\u5bc6\u6587\u672c\u6587\u4ef6\u7684\u793a\u4f8b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def encrypt_file(file_path, key):<\/p>\n<p>    with open(file_path, &#39;r&#39;) as file:<\/p>\n<p>        plain_text = file.read()<\/p>\n<p>    encrypted_text = encrypt(plain_text, key)<\/p>\n<p>    with open(file_path + &#39;.enc&#39;, &#39;w&#39;) as file:<\/p>\n<p>        file.write(encrypted_text)<\/p>\n<p>def decrypt_file(file_path, key):<\/p>\n<p>    with open(file_path, &#39;r&#39;) as file:<\/p>\n<p>        encrypted_text = file.read()<\/p>\n<p>    decrypted_text = decrypt(encrypted_text, key)<\/p>\n<p>    with open(file_path.replace(&#39;.enc&#39;, &#39;&#39;), &#39;w&#39;) as file:<\/p>\n<p>        file.write(decrypted_text)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>5.2 \u793a\u4f8b\u8c03\u7528<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">key = get_random_bytes(16)  # \u751f\u6210\u4e00\u4e2a16\u5b57\u8282\u7684\u5bc6\u94a5<\/p>\n<p>encrypt_file(&#39;example.txt&#39;, key)<\/p>\n<p>decrypt_file(&#39;example.txt.enc&#39;, key)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>5.3 \u5b89\u5168\u6027\u6ce8\u610f\u4e8b\u9879<\/h3>\n<\/p>\n<ol>\n<li><strong>\u5bc6\u94a5\u7ba1\u7406<\/strong>\uff1a\u5bc6\u94a5\u7684\u5b89\u5168\u5b58\u50a8\u548c\u7ba1\u7406\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u6216\u4e13\u95e8\u7684\u5bc6\u94a5\u7ba1\u7406\u670d\u52a1\u3002<\/li>\n<li><strong>\u52a0\u5bc6\u7b97\u6cd5\u9009\u62e9<\/strong>\uff1a\u9009\u62e9\u5408\u9002\u7684\u52a0\u5bc6\u7b97\u6cd5\u548c\u6a21\u5f0f\uff0c\u786e\u4fdd\u6570\u636e\u7684\u5b89\u5168\u6027\u3002<\/li>\n<li><strong>\u6570\u636e\u5b8c\u6574\u6027<\/strong>\uff1a\u4f7f\u7528\u54c8\u5e0c\u52a0\u5bc6\u9a8c\u8bc1\u6570\u636e\u7684\u5b8c\u6574\u6027\uff0c\u9632\u6b62\u6570\u636e\u7be1\u6539\u3002<\/li>\n<\/ol>\n<p><h2>\u516d\u3001\u603b\u7ed3<\/h2>\n<\/p>\n<p><p>\u901a\u8fc7\u672c\u6587\uff0c\u6211\u4eec\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528Python\u5b9e\u73b0\u52a0\u89e3\u5bc6\u6587\u672c\u6587\u4ef6\u3002\u4e3b\u8981\u6db5\u76d6\u4e86\u5bf9\u79f0\u52a0\u5bc6\u3001\u975e\u5bf9\u79f0\u52a0\u5bc6\u548c\u54c8\u5e0c\u52a0\u5bc6\u4e09\u79cd\u4e3b\u8981\u6280\u672f\u3002\u6bcf\u79cd\u6280\u672f\u90fd\u6709\u5176\u7279\u5b9a\u7684\u5e94\u7528\u573a\u666f\u548c\u4f18\u7f3a\u70b9\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u9009\u62e9\u5408\u9002\u7684\u52a0\u5bc6\u6280\u672f\u548c\u7b97\u6cd5\u81f3\u5173\u91cd\u8981\uff0c\u540c\u65f6\u8981\u6ce8\u610f\u5bc6\u94a5\u7684\u7ba1\u7406\u548c\u6570\u636e\u7684\u5b8c\u6574\u6027\u9a8c\u8bc1\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u548c\u5b9e\u73b0\u52a0\u89e3\u5bc6\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u9002\u5408\u7684\u52a0\u5bc6\u7b97\u6cd5\u6765\u4fdd\u62a4\u6211\u7684\u6587\u672c\u6587\u4ef6\uff1f<\/strong><br \/>\u5728\u4f7f\u7528Python\u5b9e\u73b0\u6587\u672c\u6587\u4ef6\u7684\u52a0\u89e3\u5bc6\u65f6\uff0c\u9009\u62e9\u5408\u9002\u7684\u52a0\u5bc6\u7b97\u6cd5\u81f3\u5173\u91cd\u8981\u3002\u5e38\u7528\u7684\u52a0\u5bc6\u7b97\u6cd5\u5305\u62ecAES\u3001DES\u548cRSA\u7b49\u3002AES\uff08\u9ad8\u7ea7\u52a0\u5bc6\u6807\u51c6\uff09\u56e0\u5176\u5b89\u5168\u6027\u548c\u6548\u7387\u88ab\u5e7f\u6cdb\u4f7f\u7528\u3002\u53ef\u4ee5\u4f7f\u7528<code>pycryptodome<\/code>\u5e93\u6765\u5b9e\u73b0AES\u52a0\u5bc6\uff0c\u786e\u4fdd\u4f7f\u7528\u5bf9\u79f0\u5bc6\u94a5\u52a0\u5bc6\u4e0e\u89e3\u5bc6\u7684\u65b9\u5f0f\u3002\u4e86\u89e3\u6bcf\u79cd\u7b97\u6cd5\u7684\u4f18\u7f3a\u70b9\u4ee5\u53ca\u9002\u7528\u573a\u666f\uff0c\u80fd\u591f\u5e2e\u52a9\u4f60\u505a\u51fa\u66f4\u660e\u667a\u7684\u9009\u62e9\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5982\u4f55\u5904\u7406\u52a0\u5bc6\u6587\u4ef6\u7684\u8bfb\u53d6\u548c\u5199\u5165\uff1f<\/strong><br \/>\u5904\u7406\u52a0\u5bc6\u6587\u4ef6\u65f6\uff0c\u786e\u4fdd\u6587\u4ef6\u7684\u8bfb\u53d6\u548c\u5199\u5165\u64cd\u4f5c\u6b63\u786e\u975e\u5e38\u91cd\u8981\u3002\u4f7f\u7528<code>open()<\/code>\u51fd\u6570\u65f6\uff0c\u786e\u4fdd\u4ee5\u4e8c\u8fdb\u5236\u6a21\u5f0f\u6253\u5f00\u6587\u4ef6\uff08<code>&#39;rb&#39;<\/code>\u6216<code>&#39;wb&#39;<\/code>\uff09\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u5b57\u7b26\u7f16\u7801\u95ee\u9898\u3002\u5728\u52a0\u5bc6\u6587\u672c\u6587\u4ef6\u65f6\uff0c\u8bfb\u5165\u6587\u4ef6\u5185\u5bb9\u540e\u8fdb\u884c\u52a0\u5bc6\uff0c\u518d\u5c06\u52a0\u5bc6\u540e\u7684\u6570\u636e\u5199\u5165\u65b0\u7684\u6587\u4ef6\u3002\u540c\u6837\uff0c\u5728\u89e3\u5bc6\u65f6\uff0c\u8bfb\u53d6\u52a0\u5bc6\u6587\u4ef6\u540e\u8fdb\u884c\u89e3\u5bc6\uff0c\u518d\u5c06\u89e3\u5bc6\u540e\u7684\u5185\u5bb9\u5199\u5165\u76ee\u6807\u6587\u4ef6\u3002<\/p>\n<p><strong>\u5982\u4f55\u786e\u4fdd\u6211\u7684\u52a0\u5bc6\u5bc6\u94a5\u5b89\u5168\uff1f<\/strong><br \/>\u52a0\u5bc6\u5bc6\u94a5\u7684\u5b89\u5168\u6027\u662f\u4fdd\u62a4\u6570\u636e\u9690\u79c1\u7684\u5173\u952e\u3002\u5efa\u8bae\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u6216\u5b89\u5168\u5bc6\u94a5\u7ba1\u7406\u5de5\u5177\uff08\u5982AWS Secrets Manager\u6216HashiCorp Vault\uff09\u6765\u5b58\u50a8\u5bc6\u94a5\uff0c\u800c\u4e0d\u662f\u786c\u7f16\u7801\u5728\u4ee3\u7801\u4e2d\u3002\u6b64\u5916\uff0c\u5b9a\u671f\u66f4\u6362\u5bc6\u94a5\u548c\u9650\u5236\u5bc6\u94a5\u7684\u8bbf\u95ee\u6743\u9650\u4e5f\u662f\u589e\u5f3a\u5b89\u5168\u6027\u7684\u6709\u6548\u63aa\u65bd\u3002\u786e\u4fdd\u5728\u52a0\u5bc6\u548c\u89e3\u5bc6\u8fc7\u7a0b\u4e2d\u53ea\u5728\u5185\u5b58\u4e2d\u4f7f\u7528\u5bc6\u94a5\uff0c\u907f\u514d\u5c06\u5176\u5199\u5165\u78c1\u76d8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u7528Python\u5b9e\u73b0\u52a0\u89e3\u5bc6\u6587\u672c\u6587\u4ef6 \u4f7f\u7528Python\u5b9e\u73b0\u52a0\u89e3\u5bc6\u6587\u672c\u6587\u4ef6\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5982\u5bf9\u79f0\u52a0\u5bc6\u3001\u975e\u5bf9\u79f0\u52a0\u5bc6\u3001 [&hellip;]","protected":false},"author":3,"featured_media":1132532,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1132521"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1132521"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1132521\/revisions"}],"predecessor-version":[{"id":1132534,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1132521\/revisions\/1132534"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1132532"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1132521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1132521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1132521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}