import JSEncrypt from 'jsencrypt/bin/jsencrypt'

export function Encrypt(msg){
    let encryptor = new JSEncrypt() // 新建JSEncrypt对象
 
    let publicKey = `MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnnN+B85XMqZfwjFon/D+wsLrH
    1/IPmWa9hwM/9DWK7Z2Q+Tvbxx2WHnL2r3x/0RO5DelfhxTAuPHFmj67SfSlTXce
    bZt2ZJLRhg0pDbpVyTILpKzUVYq3kl0AJoUTNv4qSQyRb8tL82ZgJObvLc5CvDN5
    fd4hBhVrRKVF5aOX7QIDAQAB`
    encryptor.setPublicKey(publicKey)

    return encryptor.encrypt(msg) 
}

export function Decrypt(secretWord){

 let decrypt = new JSEncrypt() // 新建JSEncrypt对象

 let privateKey = `MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKec34Hzlcypl/CM
 Wif8P7CwusfX8g+ZZr2HAz/0NYrtnZD5O9vHHZYecvavfH/RE7kN6V+HFMC48cWa
 PrtJ9KVNdx5tm3ZkktGGDSkNulXJMgukrNRVireSXQAmhRM2/ipJDJFvy0vzZmAk
 5u8tzkK8M3l93iEGFWtEpUXlo5ftAgMBAAECgYADOkQbjoM9864XVbyOtI7NajnO
 i1v/7OZLlAP+AUfeqwCzv/jlHIp3T5LLKUnudCo7EAeEbWd65pTRR00Z8iyh0kYQ
 fNfUQ88DINAX8McTozFJP5s0E1PaeORaBcpy//qdDmRbAUya8bqyY92q1MmdHX1b
 /4z3kbvUSTimaCuVwQJBANe2oXj1sDW2CWF5M30aoxpATNqoZzUtoB7LDRtCthXN
 T8ibC86iQ9VzrEc+OvUv5iQEXtMGMUgq5GwMwaC4tokCQQDG6obqCPJ6eGHwzjpb
 rQCGL7qNEeEM53pK1RxlosLf82HNpZMWfPaakoa36rFJ+UJnzw5PxQv/wytZa48O
 jf1FAkEAo4btrhcCuBUB04TgBYz17GamXHShmOy3n+BqVSojgy+btgXj04erSNth
 1LhWVZ00KEWv5OWi4oSxmT+qYb7lkQJAA5Az9oFOhq8dYgjvtrC0r7KvLtPBKlAD
 Os/ygEeYIhbkC6EJr39xk3dIfobvwhl6/Q0Sfo9TFbPTVPi+SU512QJBAISrfyP6
 WQI3AoY1cNU/C2PVDan28NCP/U1I26K1+5WDASX/PiQBwQtMbg4VkbABU429O065
 D9csEdHix0CDolc=`

    decrypt.setPrivateKey(privateKey)

    return decrypt.decrypt(secretWord)
}