From 44e29be21af596ac4088c7c76fa32cf9701cf081 Mon Sep 17 00:00:00 2001 From: TRHX Date: Mon, 18 Mar 2024 00:30:07 +0800 Subject: [PATCH] add: rsa convert Key --- .../07.rsa.md" | 353 ++++++++++++++++-- 1 file changed, 318 insertions(+), 35 deletions(-) diff --git "a/docs/03.\350\276\205\345\212\251\346\237\245\350\257\242/04.\345\212\240\345\257\206\347\256\227\346\263\225/07.rsa.md" "b/docs/03.\350\276\205\345\212\251\346\237\245\350\257\242/04.\345\212\240\345\257\206\347\256\227\346\263\225/07.rsa.md" index 8a17e23c..d1bab39d 100644 --- "a/docs/03.\350\276\205\345\212\251\346\237\245\350\257\242/04.\345\212\240\345\257\206\347\256\227\346\263\225/07.rsa.md" +++ "b/docs/03.\350\276\205\345\212\251\346\237\245\350\257\242/04.\345\212\240\345\257\206\347\256\227\346\263\225/07.rsa.md" @@ -1068,6 +1068,9 @@ g2c+B9GgZ+Nou4ne4WXjOVUWZuuch7yqn3XoxeQT4/xaCw== ``` ## 转换密钥 + +RSA 的公钥语法标准有:pkcs1、spki,私钥的语法标准有:pkcs1、pkcs8,已知一个语法标准的秘钥,可以将其转换成另一种语法标准的秘钥,同时秘钥最终的格式 pem、der 也是可以相互转换的。 + ### Python
@@ -1082,22 +1085,22 @@ g2c+B9GgZ+Nou4ne4WXjOVUWZuuch7yqn3XoxeQT4/xaCw== from Crypto.PublicKey import RSA - def pkcs1_to_spki(public_key_pkcs1, output_format="DER"): - # 将 pkcs1 标准的公钥转换为 spki 标准,返回 der 或者 pem 格式的公钥 + def pkcs1_to_spki(public_key_pkcs1, output_format="PEM"): + # 将 pkcs1 标准的公钥转换为 spki 标准,返回 pem 或者 der 格式的公钥 public_key_pkcs1 = RSA.import_key(public_key_pkcs1) public_key_spki = public_key_pkcs1.export_key(format=output_format.upper()) return public_key_spki.decode() - def pkcs1_to_pkcs8(private_key_pkcs1, output_format="DER"): - # 将 pkcs1 标准的私钥转换为 pkcs8 标准,返回 der 或者 pem 格式的公钥 + def pkcs1_to_pkcs8(private_key_pkcs1, output_format="PEM"): + # 将 pkcs1 标准的私钥转换为 pkcs8 标准,返回 pem 或者 der 格式的公钥 private_key_pkcs1 = RSA.import_key(private_key_pkcs1) private_key_pkcs8 = private_key_pkcs1.export_key(format=output_format.upper(), pkcs=8) return private_key_pkcs8.decode() - def pkcs8_to_pkcs1(private_key_pkcs8, output_format="DER"): - # 将 pkcs8 标准的私钥转换为 pkcs1 标准,返回 der 或者 pem 格式的公钥 + def pkcs8_to_pkcs1(private_key_pkcs8, output_format="PEM"): + # 将 pkcs8 标准的私钥转换为 pkcs1 标准,返回 pem 或者 der 格式的公钥 private_key_pkcs8 = RSA.import_key(private_key_pkcs8) private_key_pkcs1 = private_key_pkcs8.export_key(format=output_format.upper(), pkcs=1) return private_key_pkcs1.decode() @@ -1168,7 +1171,6 @@ g2c+B9GgZ+Nou4ne4WXjOVUWZuuch7yqn3XoxeQT4/xaCw== nHPppz1nsV+COkxXQV4= -----END PRIVATE KEY----- """ - ``` @@ -1183,8 +1185,8 @@ g2c+B9GgZ+Nou4ne4WXjOVUWZuuch7yqn3XoxeQT4/xaCw== from cryptography.hazmat.primitives.serialization import load_pem_public_key, load_pem_private_key - def pkcs1_to_spki(public_key_pkcs1, output_format="DER"): - # 将 pkcs1 标准的公钥转换为 spki 标准,返回 der 或者 pem 格式的公钥 + def pkcs1_to_spki(public_key_pkcs1, output_format="PEM"): + # 将 pkcs1 标准的公钥转换为 spki 标准,返回 pem 或者 der 格式的公钥 if output_format.upper() == "DER": encoding = serialization.Encoding.DER else: @@ -1197,8 +1199,8 @@ g2c+B9GgZ+Nou4ne4WXjOVUWZuuch7yqn3XoxeQT4/xaCw== return public_key_spki.decode() - def spki_to_pkcs1(public_key_spki, output_format="DER"): - # 将 spki 标准的公钥转换为 pkcs1 标准,返回 der 或者 pem 格式的公钥 + def spki_to_pkcs1(public_key_spki, output_format="PEM"): + # 将 spki 标准的公钥转换为 pkcs1 标准,返回 pem 或者 der 格式的公钥 if output_format.upper() == "DER": encoding = serialization.Encoding.DER else: @@ -1206,13 +1208,13 @@ g2c+B9GgZ+Nou4ne4WXjOVUWZuuch7yqn3XoxeQT4/xaCw== public_key_spki = load_pem_public_key(public_key_spki.encode()) public_key_pkcs1 = public_key_spki.public_bytes( encoding=encoding, - format=serialization.PublicFormat.SubjectPublicKeyInfo + format=serialization.PublicFormat.PKCS1 ) return public_key_pkcs1.decode() - def pkcs1_to_pkcs8(private_key_pkcs1, output_format="DER"): - # 将 pkcs1 标准的私钥转换为 pkcs8 标准,返回 der 或者 pem 格式的公钥 + def pkcs1_to_pkcs8(private_key_pkcs1, output_format="PEM"): + # 将 pkcs1 标准的私钥转换为 pkcs8 标准,返回 pem 或者 der 格式的公钥 if output_format.upper() == "DER": encoding = serialization.Encoding.DER else: @@ -1265,12 +1267,11 @@ g2c+B9GgZ+Nou4ne4WXjOVUWZuuch7yqn3XoxeQT4/xaCw== """ 公钥转换 spki => pkcs1: - -----BEGIN PUBLIC KEY----- - MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCl7HWuXcOH9I/Bud7dplYxHOEC - D82fJv1WJKADhmILCxDLJLVkueBQfwUItPELF3RLhs+3+XNYfGiz7PPPhxV1pey5 - jrHT8zw8InrNRwlDeCyx/Q+ETpSpQImvILf0RBHtnOgVpb41uhKF24wGH4q7+faN - w6cBVKhFn+fuItSGfQIDAQAB - -----END PUBLIC KEY----- + -----BEGIN RSA PUBLIC KEY----- + MIGJAoGBAKXsda5dw4f0j8G53t2mVjEc4QIPzZ8m/VYkoAOGYgsLEMsktWS54FB/ + BQi08QsXdEuGz7f5c1h8aLPs88+HFXWl7LmOsdPzPDwies1HCUN4LLH9D4ROlKlA + ia8gt/REEe2c6BWlvjW6EoXbjAYfirv59o3DpwFUqEWf5+4i1IZ9AgMBAAE= + -----END RSA PUBLIC KEY----- 私钥转换 pkcs1 => pkcs8: @@ -1291,32 +1292,314 @@ g2c+B9GgZ+Nou4ne4WXjOVUWZuuch7yqn3XoxeQT4/xaCw== vKqfdejF5BPj/FoL -----END PRIVATE KEY----- """ - ``` ### JavaScript -
- - - +```javascript +// ✅ Node.js 内置 crypto 模块,无需单独安装 - - - +const crypto = require("crypto"); + +function PKCS1ToSPKI(publicKeyPkcs1, outputFormat="pem") { + // 将 pkcs1 标准的公钥转换为 spki 标准,返回 pem 或者 der 格式的公钥 + const publicKeySpki = crypto.createPublicKey({ key: publicKeyPkcs1, type: "pkcs1" }); + return publicKeySpki.export({ type: "spki", format: outputFormat.toLowerCase() }); +} + +function SPKIToPKCS1(publicKeySpki, outputFormat="pem") { + // 将 spki 标准的公钥转换为 pkcs1 标准,返回 pem 或者 der 格式的公钥 + const publicKeyPkcs1 = crypto.createPublicKey({ key: publicKeySpki, type: "spki" }); + return publicKeyPkcs1.export({ type: "pkcs1", format: outputFormat.toLowerCase() }); +} + +function PKCS1ToPKCS8(privateKeyPkcs1, outputFormat="pem") { + // 将 pkcs1 标准的私钥转换为 pkcs8 标准,返回 pem 或者 der 格式的公钥 + const privateKeyPkcs8 = crypto.createPrivateKey({ key: privateKeyPkcs1, type: "pkcs1" }); + return privateKeyPkcs8.export({ type: "pkcs8", format: outputFormat.toLowerCase() }); +} + +function PKCS8ToPKCS1(privateKeyPkcs8, outputFormat="pem") { + // 将 pkcs8 标准的私钥转换为 pkcs1 标准,返回 pem 或者 der 格式的公钥 + const privateKeyPkcs1 = crypto.createPrivateKey({ key: privateKeyPkcs8, type: "pkcs8" }); + return privateKeyPkcs1.export({ type: "pkcs1", format: outputFormat.toLowerCase() }); +} + + +// pkcs1 标准 pem 格式的公钥 +const publicKeyPkcs1Pem = ` +-----BEGIN RSA PUBLIC KEY----- +MIGJAoGBALLA/aUElSxqvPUnlC4A8UaNh6txyrjlLshW4/wUgWZIBBbvp7yVj4Oi +C5mbbbyvOqElQNhkaeV8EF2rZqy9m5whs+jIx1tUdyJPJXLyZCNr3Q8t4sQyek6q +1+imN6KUEIHrLveuYq1Lvmw3lt52vRzvWwucYV0EHSbx3G0b6hErAgMBAAE= +-----END RSA PUBLIC KEY----- +` + +// pkcs1 标准 pem 格式的私钥 +const privateKeyPkcs1Pem = ` +-----BEGIN RSA PRIVATE KEY----- +MIICYAIBAAKBgQCywP2lBJUsarz1J5QuAPFGjYerccq45S7IVuP8FIFmSAQW76e8 +lY+DoguZm228rzqhJUDYZGnlfBBdq2asvZucIbPoyMdbVHciTyVy8mQja90PLeLE +MnpOqtfopjeilBCB6y73rmKtS75sN5bedr0c71sLnGFdBB0m8dxtG+oRKwIDAQAB +AoGADOrlaYdrQEp2XUD+9FQdG3we0cTnYXUubEvbLdxNfZa2tPGcrYQhWuHa9L7G +r1v6YKrQhNK81Fii1iIMvBnzkVIakhSYvC294yyEZG+fYJcXuZWzoF0+YUrlFP0b +vG5JOpDcUN4YG+tG924AbhyPL0AJkX0BEElSWaFhVtnTxAECRQC4fMLIzE2hCq9F +UmR59YDSHasPUVDWuq0eXG+P/0Kp9x5ZUDjZcojcBhpsJBQbx9P4ygyiYj4uUw3O +SA8X/fZHxqmg/QI9APgLR5Uz5Veaj1PguhkoKB3384PnrrKoFD+wgc6H7Qib9aKG +KT0x5dKswZefyE/PF+Qi7hMWiO18FK2HRwJEb/eQREvyhV21uE3kGzzL3ToSWq6Q +cHJFpVqWfv9+Fyea7LvKdPaVZ2vw11ciOSYTWThPaLJVaMoRY/PJ7Va+BRvmUYUC +PQCO06fnYReZRxVq3gcqvzXCc+kTtg+hLilitxc3vosdnvhlGk2awCWvFuzuiwID ++qKuKfLeqOY1oXIirbcCRGtG4PspKLAQMO6jI7bFUc5if9UKo6TGeu39E3qtv4jW +NW6qObPBJ9R1gurMqPUT9g630xjZdZxz6ac9Z7FfgjpMV0Fe +-----END RSA PRIVATE KEY----- +` + + +// 转换公钥:pkcs1 => spki +var publicKeySpkiPem = PKCS1ToSPKI(publicKeyPkcs1Pem, "pem") + +// 转换私钥:pkcs1 => pkcs8 +var privateKeyPkcs8Pem = PKCS1ToPKCS8(privateKeyPkcs1Pem, "pem") + +console.log("公钥转换 pkcs1 => spki:\n\n", publicKeySpkiPem) +console.log("私钥转换 pkcs1 => pkcs8:\n\n", privateKeyPkcs8Pem) + + +/* +公钥转换 pkcs1 => spki: + + -----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCywP2lBJUsarz1J5QuAPFGjYer +ccq45S7IVuP8FIFmSAQW76e8lY+DoguZm228rzqhJUDYZGnlfBBdq2asvZucIbPo +yMdbVHciTyVy8mQja90PLeLEMnpOqtfopjeilBCB6y73rmKtS75sN5bedr0c71sL +nGFdBB0m8dxtG+oRKwIDAQAB +-----END PUBLIC KEY----- + +私钥转换 pkcs1 => pkcs8: + + -----BEGIN PRIVATE KEY----- +MIICegIBADANBgkqhkiG9w0BAQEFAASCAmQwggJgAgEAAoGBALLA/aUElSxqvPUn +lC4A8UaNh6txyrjlLshW4/wUgWZIBBbvp7yVj4OiC5mbbbyvOqElQNhkaeV8EF2r +Zqy9m5whs+jIx1tUdyJPJXLyZCNr3Q8t4sQyek6q1+imN6KUEIHrLveuYq1Lvmw3 +lt52vRzvWwucYV0EHSbx3G0b6hErAgMBAAECgYAM6uVph2tASnZdQP70VB0bfB7R +xOdhdS5sS9st3E19lra08ZythCFa4dr0vsavW/pgqtCE0rzUWKLWIgy8GfORUhqS +FJi8Lb3jLIRkb59glxe5lbOgXT5hSuUU/Ru8bkk6kNxQ3hgb60b3bgBuHI8vQAmR +fQEQSVJZoWFW2dPEAQJFALh8wsjMTaEKr0VSZHn1gNIdqw9RUNa6rR5cb4//Qqn3 +HllQONlyiNwGGmwkFBvH0/jKDKJiPi5TDc5IDxf99kfGqaD9Aj0A+AtHlTPlV5qP +U+C6GSgoHffzg+eusqgUP7CBzoftCJv1ooYpPTHl0qzBl5/IT88X5CLuExaI7XwU +rYdHAkRv95BES/KFXbW4TeQbPMvdOhJarpBwckWlWpZ+/34XJ5rsu8p09pVna/DX +VyI5JhNZOE9oslVoyhFj88ntVr4FG+ZRhQI9AI7Tp+dhF5lHFWreByq/NcJz6RO2 +D6EuKWK3Fze+ix2e+GUaTZrAJa8W7O6LAgP6oq4p8t6o5jWhciKttwJEa0bg+yko +sBAw7qMjtsVRzmJ/1QqjpMZ67f0Teq2/iNY1bqo5s8En1HWC6syo9RP2DrfTGNl1 +nHPppz1nsV+COkxXQV4= +-----END PRIVATE KEY----- +*/ +``` ### Golang -
- - - +```go +// ✅ 无需安装依赖,官方文档:https://pkg.go.dev/crypto - - - +package main + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "errors" + "fmt" + "strings" +) + +// PKCS1ToSPKI 将 pkcs1 标准的公钥转换为 spki 标准,返回 pem 或者 der 格式的公钥 +func PKCS1ToSPKI(publicKeyPkcs1, outputFormat string) ([]byte, error) { + block, _ := pem.Decode([]byte(publicKeyPkcs1)) + if block == nil { + return nil, errors.New("failed to decode PEM block containing public key") + } + publicKey, err := x509.ParsePKCS1PublicKey(block.Bytes) + if err != nil { + return nil, err + } + + publicKeySpkiBytes, err := x509.MarshalPKIXPublicKey(publicKey) + if err != nil { + return nil, err + } + + if strings.ToUpper(outputFormat) == "DER" { + return publicKeySpkiBytes, nil + } + + publicKeySpki := &pem.Block{ + Type: "PUBLIC KEY", + Bytes: publicKeySpkiBytes, + } + return pem.EncodeToMemory(publicKeySpki), nil +} + +// SPKIToPKCS1 将 SPKI 格式的公钥转换为 PKCS1 格式 +func SPKIToPKCS1(publicKeySpki, outputFormat string) ([]byte, error) { + block, _ := pem.Decode([]byte(publicKeySpki)) + if block == nil { + return nil, errors.New("failed to decode PEM block containing public key") + } + publicKey, err := x509.ParsePKIXPublicKey(block.Bytes) + if err != nil { + return nil, err + } + + rsaPublicKey, ok := publicKey.(*rsa.PublicKey) + if !ok { + return nil, errors.New("not an RSA public key") + } + publicKeyPkcs1Bytes := x509.MarshalPKCS1PublicKey(rsaPublicKey) + + if strings.ToUpper(outputFormat) == "DER" { + return publicKeyPkcs1Bytes, nil + } + + publicKeyPkcs1 := &pem.Block{ + Type: "RSA PUBLIC KEY", + Bytes: publicKeyPkcs1Bytes, + } + return pem.EncodeToMemory(publicKeyPkcs1), nil +} + +// PKCS1ToPKCS8 将 pkcs1 标准的私钥转换为 pkcs8 标准,返回 pem 或者 der 格式的公钥 +func PKCS1ToPKCS8(privateKeyPkcs1, outputFormat string) ([]byte, error) { + block, _ := pem.Decode([]byte(privateKeyPkcs1)) + if block == nil { + return nil, errors.New("failed to decode PEM block containing public key") + } + privateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes) + if err != nil { + return nil, err + } + + privateKeyPkcs8Bytes, err := x509.MarshalPKCS8PrivateKey(privateKey) + if err != nil { + return nil, err + } + + if strings.ToUpper(outputFormat) == "DER" { + return privateKeyPkcs8Bytes, nil + } + + privateKeyPkcs8 := &pem.Block{ + Type: "PRIVATE KEY", + Bytes: privateKeyPkcs8Bytes, + } + return pem.EncodeToMemory(privateKeyPkcs8), nil +} + +// PKCS8ToPKCS1 将 pkcs8 标准的私钥转换为 pkcs1 标准,返回 pem 或者 der 格式的公钥 +func PKCS8ToPKCS1(privateKeyPkcs8, outputFormat string) ([]byte, error) { + block, _ := pem.Decode([]byte(privateKeyPkcs8)) + if block == nil { + return nil, errors.New("failed to decode PEM block containing public key") + } + privateKey, err := x509.ParsePKCS8PrivateKey(block.Bytes) + if err != nil { + return nil, err + } + + rsaPrivateKey, ok := privateKey.(*rsa.PrivateKey) + if !ok { + return nil, errors.New("not an RSA public key") + } + privateKeyPkcs1Bytes := x509.MarshalPKCS1PrivateKey(rsaPrivateKey) + + if strings.ToUpper(outputFormat) == "DER" { + return privateKeyPkcs1Bytes, nil + } + + privateKeyPkcs1 := &pem.Block{ + Type: "RSA PRIVATE KEY", + Bytes: privateKeyPkcs1Bytes, + } + return pem.EncodeToMemory(privateKeyPkcs1), nil +} + +func main() { + // pkcs1 标准 pem 格式的公钥 + publicKeyPkcs1Pem := ` +-----BEGIN RSA PUBLIC KEY----- +MIGJAoGBALLA/aUElSxqvPUnlC4A8UaNh6txyrjlLshW4/wUgWZIBBbvp7yVj4Oi +C5mbbbyvOqElQNhkaeV8EF2rZqy9m5whs+jIx1tUdyJPJXLyZCNr3Q8t4sQyek6q +1+imN6KUEIHrLveuYq1Lvmw3lt52vRzvWwucYV0EHSbx3G0b6hErAgMBAAE= +-----END RSA PUBLIC KEY----- +` + + // pkcs1 标准 pem 格式的私钥 + privateKeyPkcs1Pem := ` +-----BEGIN RSA PRIVATE KEY----- +MIICYAIBAAKBgQCywP2lBJUsarz1J5QuAPFGjYerccq45S7IVuP8FIFmSAQW76e8 +lY+DoguZm228rzqhJUDYZGnlfBBdq2asvZucIbPoyMdbVHciTyVy8mQja90PLeLE +MnpOqtfopjeilBCB6y73rmKtS75sN5bedr0c71sLnGFdBB0m8dxtG+oRKwIDAQAB +AoGADOrlaYdrQEp2XUD+9FQdG3we0cTnYXUubEvbLdxNfZa2tPGcrYQhWuHa9L7G +r1v6YKrQhNK81Fii1iIMvBnzkVIakhSYvC294yyEZG+fYJcXuZWzoF0+YUrlFP0b +vG5JOpDcUN4YG+tG924AbhyPL0AJkX0BEElSWaFhVtnTxAECRQC4fMLIzE2hCq9F +UmR59YDSHasPUVDWuq0eXG+P/0Kp9x5ZUDjZcojcBhpsJBQbx9P4ygyiYj4uUw3O +SA8X/fZHxqmg/QI9APgLR5Uz5Veaj1PguhkoKB3384PnrrKoFD+wgc6H7Qib9aKG +KT0x5dKswZefyE/PF+Qi7hMWiO18FK2HRwJEb/eQREvyhV21uE3kGzzL3ToSWq6Q +cHJFpVqWfv9+Fyea7LvKdPaVZ2vw11ciOSYTWThPaLJVaMoRY/PJ7Va+BRvmUYUC +PQCO06fnYReZRxVq3gcqvzXCc+kTtg+hLilitxc3vosdnvhlGk2awCWvFuzuiwID ++qKuKfLeqOY1oXIirbcCRGtG4PspKLAQMO6jI7bFUc5if9UKo6TGeu39E3qtv4jW +NW6qObPBJ9R1gurMqPUT9g630xjZdZxz6ac9Z7FfgjpMV0Fe +-----END RSA PRIVATE KEY----- +` + // 转换公钥:pkcs1 => spki + publicKeySpkiPem, err := PKCS1ToSPKI(publicKeyPkcs1Pem, "pem") + if err != nil { + fmt.Println("Error converting public key PKCS1 to SPKI:", err) + return + } + + // 转换私钥:pkcs1 => pkcs8 + privateKeyPkcs8Pem, err := PKCS1ToPKCS8(privateKeyPkcs1Pem, "pem") + if err != nil { + fmt.Println("Error converting private key PKCS1 to PKCS8:", err) + return + } + + fmt.Println("公钥转换 pkcs1 => spki:\n\n", string(publicKeySpkiPem)) + fmt.Println("私钥转换 pkcs1 => pkcs8:\n\n", string(privateKeyPkcs8Pem)) +} + +/* +公钥转换 pkcs1 => spki: + + -----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCywP2lBJUsarz1J5QuAPFGjYer +ccq45S7IVuP8FIFmSAQW76e8lY+DoguZm228rzqhJUDYZGnlfBBdq2asvZucIbPo +yMdbVHciTyVy8mQja90PLeLEMnpOqtfopjeilBCB6y73rmKtS75sN5bedr0c71sL +nGFdBB0m8dxtG+oRKwIDAQAB +-----END PUBLIC KEY----- + +私钥转换 pkcs1 => pkcs8: + + -----BEGIN PRIVATE KEY----- +MIICegIBADANBgkqhkiG9w0BAQEFAASCAmQwggJgAgEAAoGBALLA/aUElSxqvPUn +lC4A8UaNh6txyrjlLshW4/wUgWZIBBbvp7yVj4OiC5mbbbyvOqElQNhkaeV8EF2r +Zqy9m5whs+jIx1tUdyJPJXLyZCNr3Q8t4sQyek6q1+imN6KUEIHrLveuYq1Lvmw3 +lt52vRzvWwucYV0EHSbx3G0b6hErAgMBAAECgYAM6uVph2tASnZdQP70VB0bfB7R +xOdhdS5sS9st3E19lra08ZythCFa4dr0vsavW/pgqtCE0rzUWKLWIgy8GfORUhqS +FJi8Lb3jLIRkb59glxe5lbOgXT5hSuUU/Ru8bkk6kNxQ3hgb60b3bgBuHI8vQAmR +fQEQSVJZoWFW2dPEAQJFALh8wsjMTaEKr0VSZHn1gNIdqw9RUNa6rR5cb4//Qqn3 +HllQONlyiNwGGmwkFBvH0/jKDKJiPi5TDc5IDxf99kfGqaD9Aj0A+AtHlTPlV5qP +U+C6GSgoHffzg+eusqgUP7CBzoftCJv1ooYpPTHl0qzBl5/IT88X5CLuExaI7XwU +rYdHAkRv95BES/KFXbW4TeQbPMvdOhJarpBwckWlWpZ+/34XJ5rsu8p09pVna/DX +VyI5JhNZOE9oslVoyhFj88ntVr4FG+ZRhQI9AI7Tp+dhF5lHFWreByq/NcJz6RO2 +D6EuKWK3Fze+ix2e+GUaTZrAJa8W7O6LAgP6oq4p8t6o5jWhciKttwJEa0bg+yko +sBAw7qMjtsVRzmJ/1QqjpMZ67f0Teq2/iNY1bqo5s8En1HWC6syo9RP2DrfTGNl1 +nHPppz1nsV+COkxXQV4= +-----END PRIVATE KEY----- +*/ +``` ## 加密解密 ### Python