当前位置: 首页>>代码示例>>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;未经允许,请勿转载。