# ========== RSA Encrypt ========== def publicEncRSA(pubKey, data): keyDER = base64.b64decode(pubKey) keyPub = RSA.importKey(keyDER) cipher = Cipher_PKCS1_v1_5.new(keyPub) cipher_text = cipher.encrypt(data.encode()) encryptedData = base64.b64encode(cipher_text).decode("utf-8") # print('encryptedData = ' + encryptedData) return encryptedData # ========== RSA Encrypt ========== pubKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmJ2tPgMTjsVcj7OY/DrbdHgQicicmED7guMgq3UedQkrKoD4PMeT2r1ziXFneEtaXtckF8BvbagYnsDXHmDBuj3k/npOuyoukUUl3eE2v1Np6pfaOMPYL5Ov+xhmbEfv9U+Z9wVPXpHCFoD57p4AZWxB31HWgGsUxilhXo28DHjB/ASOf3t3VMEXqoHxvfdlJx9vm8/BiX3YXuHpPB9nOGC04bseZO1wnN3woYmUZ+ZNZL2XYxongl9hJ2II2PTC9sdp6xHwRHbI+AF/RXAz8QqS9v958fuDbFT63HCSRH/bWwqliRDfpxLNOfvsgTdBIeDWNCa1akhe4qTDXPhAPwIDAQAB' encKey = publicEncRSA(pubKey, '236o1230!23') print(encKey)
$ python status_id.py U51jKvDgsqmNMDf5sPA04rKwZxsWx28w3c44DXF4E2qvgUTcOFsRNWkrNC8WktrBgkqjTcAfcxBj6hPIeJ3n0qMdGhbkmmIfeioKeTI+8msOpQ79IKsJrrN5YiFgOPA50KpEEZCdfDVXWIpsfvpqvnj0YRqB00Rc8jMgw9IPSRoDuL9fYO4qHLerB761rkBRTx01tYHFJr4sPIEu2eMB1ceqh4jI7t6cHk2aJLbgSwujZJWH1rf5ydQRqHN6XQtiCH894MX4SC/o1seUZiM8z5usE7uDUDekulHZrDJw7l3VBPEapeBvrR44J4x1sHOwP7cZC5ayxedj47BSNuoM/Q==
function publicEncRSA($pubKey, $data) { $keyDER = base64_decode($pubKey); $keyPub = openssl_pkey_get_public($keyDER); //$cipher = Cipher_PKCS1_v1_5.new($keyPub); $cipher_text = openssl_private_encrypt( $data, $crypted, $keyPub ); $encryptedData = base64_encode($cipher_text); # print('encryptedData = ' + encryptedData) return $encryptedData; }
<?php shell_exec("python3 FILE.py");?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)