當前位置: 首頁>>代碼示例>>Python>>正文


Python rsa.decrypt方法代碼示例

本文整理匯總了Python中rsa.decrypt方法的典型用法代碼示例。如果您正苦於以下問題:Python rsa.decrypt方法的具體用法?Python rsa.decrypt怎麽用?Python rsa.decrypt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rsa的用法示例。


在下文中一共展示了rsa.decrypt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: pull_aes_key

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def pull_aes_key():
    def agreemnt_key(string):
        send_data(string)
        key_rsa = sock.recv(BUFSIZE)
        return key_rsa

    import rsa
    AES_Key_RSA = agreemnt_key(b'ApplyKey')
    with open('private.pem', 'r') as f:
        priv_key = rsa.PrivateKey.load_pkcs1(f.read().encode())
    AES_Key = rsa.decrypt(AES_Key_RSA, priv_key).decode('utf-8')
    print('Obtaining Key Success!')
    return AES_Key


# AES模塊 
開發者ID:Npist,項目名稱:v2rayMS,代碼行數:18,代碼來源:v2rayMS_Client.py

示例2: accept_cfg

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def accept_cfg():
    Gud = ['pull_list']
    Gud_str = '#'.join(Gud)
    user_config_raw = accept_data(Gud_str)
    user_config_temp = crytpion.decrypt(user_config_raw)
    if user_config_temp != 'None':
        print('Update user list')
        try:
            user_config_list = [eval(i) for i in user_config_temp.split("#")]
            update_cfg(user_config_list, run_os)
            print('Update OK!')
        except Exception as e:
            print(e)
            print('Update Error!')
    else:
        print('Updates could not be found')


# 更新流量 
開發者ID:Npist,項目名稱:v2rayMS,代碼行數:21,代碼來源:v2rayMS_Client.py

示例3: update_traffic

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def update_traffic():
    Gud = ['push_traffic']
    for user in User_list:
        try:
            traffic_msg = traffic_check(user['email'])
            if traffic_msg != 0:
                Gud.append([
                    int(user['email'][:-(len(DOMAIN) + 1)]), traffic_msg[0],
                    traffic_msg[1], traffic_msg[2]
                ])
        except Exception as e:
            print('ID:' + user['email'][:-(len(DOMAIN) + 1)] +
                  ' Traffic read error!')
            print(e)
    Gud_str = '#'.join('%s' % i for i in Gud)
    if crytpion.decrypt(accept_data(Gud_str)) == '$%^':
        return
    else:
        pass


# 主函數 
開發者ID:Npist,項目名稱:v2rayMS,代碼行數:24,代碼來源:v2rayMS_Client.py

示例4: add_to_params

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def add_to_params(self, parameters, value):
        """
        This gets called with the value of our ``--priv-launch-key``
        if it is specified.  It needs to determine if the path
        provided is valid and, if it is, it stores it in the instance
        variable ``_key_path`` for use by the decrypt routine.
        """
        if value:
            path = os.path.expandvars(value)
            path = os.path.expanduser(path)
            if os.path.isfile(path):
                self._key_path = path
                endpoint_prefix = \
                    self._operation_model.service_model.endpoint_prefix
                event = 'after-call.%s.%s' % (endpoint_prefix,
                                              self._operation_model.name)
                self._session.register(event, self._decrypt_password_data)
            else:
                msg = ('priv-launch-key should be a path to the '
                       'local SSH private key file used to launch '
                       'the instance.')
                raise ValueError(msg) 
開發者ID:gkrizek,項目名稱:bash-lambda-layer,代碼行數:24,代碼來源:decryptpassword.py

示例5: decrypt_str

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def decrypt_str(self, message):
        """

        :param message:
        :return: bytes
        """
        msg = base64.b64decode(message)
        length = len(msg)
        default_length = self.default_length + 11
        # 長度不用分段
        if length < default_length:
            return rsa.decrypt(msg, self.private_key)
        # 需要分段
        offset = 0
        res = []
        while length - offset > 0:
            if length - offset > default_length:
                res.append(rsa.decrypt(msg[offset:offset + default_length], self.private_key))
            else:
                res.append(rsa.decrypt(msg[offset:], self.private_key))
            offset += default_length
        return b''.join(res) 
開發者ID:seecode-audit,項目名稱:seecode-scanner,代碼行數:24,代碼來源:rsaencrypt.py

示例6: Check_Token

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def Check_Token(self, token_crypto, ip, ua):
        global re_dict
        if str(token_crypto)[-4:-1] != "NQZ":
            return "[-]token flag is error!"
        else:
            # with open('../project/Helper/privkey.pem','r') as f:
            #     privkey = rsa.PrivateKey.load_pkcs1(f.read().encode())

            token_message = base64.b64decode(token_crypto[:-4])

            # token_message = rsa.decrypt(token_crypto, privkey)
            print("RSA解密後 ", token_message)
            message       = AES_Crypt_Cookies()
            if message.Decrypt_Check_Token(token_message, ip, ua):
                # token 校驗成功,合法
                re_dict["token_status"] = ReturnStatus.TOKEN_ERROR
            else:
                # token 校驗失敗,不合法
                re_dict["token_status"] = ReturnStatus.TOKEN_SUCCESS 
開發者ID:listen-now,項目名稱:listen-now,代碼行數:21,代碼來源:bcrypt_hash.py

示例7: decodebytes

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def decodebytes(self, text):
        aes = self.aes()
        return str(aes.decrypt(base64.decodebytes(bytes(
            text, encoding='utf8'))).rstrip(b'\0').decode("utf8"))  # 解密 
開發者ID:inlike,項目名稱:R-A-M-D-D3-S-M-H,代碼行數:6,代碼來源:RSA-AES-MD5-DES-DES3-MD5-SHA-HMAC.py

示例8: rsaDecrypt

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def rsaDecrypt(self, text):
        """
        :param text:bytes 
        :return: str
        """
        content = rsa.decrypt(text, self.privkey)
        con = content.decode('utf-8')
        return con 
開發者ID:inlike,項目名稱:R-A-M-D-D3-S-M-H,代碼行數:10,代碼來源:RSA-AES-MD5-DES-DES3-MD5-SHA-HMAC.py

示例9: descrypt

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def descrypt(self, text):
        """
        DES 解密
        :param text: 加密後的字符串,bytes
        :return:  解密後的字符串
        """
        secret_key = self.key
        iv = self.iv
        k = des(secret_key, CBC, iv, pad=None, padmode=PAD_PKCS5)
        de = k.decrypt(text, padmode=PAD_PKCS5)
        return de.decode() 
開發者ID:inlike,項目名稱:R-A-M-D-D3-S-M-H,代碼行數:13,代碼來源:RSA-AES-MD5-DES-DES3-MD5-SHA-HMAC.py

示例10: decrypt

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def decrypt(self, text):
        cryptor = DES3.new(self.key, self.mode)
        plain_text = cryptor.decrypt(text)
        st = str(plain_text.decode("utf-8")).rstrip('\0')
        return st 
開發者ID:inlike,項目名稱:R-A-M-D-D3-S-M-H,代碼行數:7,代碼來源:RSA-AES-MD5-DES-DES3-MD5-SHA-HMAC.py

示例11: decrypt

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def decrypt(self, text):
        cryptor = self.AES.new(self.key, self.mode, self.iv)
        plain_text = cryptor.decrypt(self.a2b_hex(text))
        return plain_text.rstrip(b'\0').decode() 
開發者ID:Npist,項目名稱:v2rayMS,代碼行數:6,代碼來源:v2rayMS_Client.py

示例12: decrypt

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def decrypt(crypto):
    message = rsa.decrypt(crypto, privkey)
    return message 
開發者ID:rfyiamcool,項目名稱:swift_rpc,代碼行數:5,代碼來源:rsalib.py

示例13: rsa_long_decrypt

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def rsa_long_decrypt(self, crypto, length = 128):
		res = []

		for i in range(0, len(crypto), length):
			res.append(rsa.decrypt(crypto[i : i + length], self.privkey))

		return b"".join(res) 
開發者ID:turingsec,項目名稱:marsnake,代碼行數:9,代碼來源:security.py

示例14: aes_decrypt

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def aes_decrypt(self, encrypt):
		return self.aes_encrypt(encrypt)
		#aes_obj_enc = AES.new(self.aes, AES.MODE_CBC, self.iv)
		#return aes_obj_enc.decrypt(encrypt).rstrip(PADDING) 
開發者ID:turingsec,項目名稱:marsnake,代碼行數:6,代碼來源:security.py

示例15: perform_operation

# 需要導入模塊: import rsa [as 別名]
# 或者: from rsa import decrypt [as 別名]
def perform_operation(self, indata, priv_key, cli_args=None):
        """Decrypts files."""

        return rsa.decrypt(indata, priv_key) 
開發者ID:Deltares,項目名稱:aqua-monitor,代碼行數:6,代碼來源:cli.py


注:本文中的rsa.decrypt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。