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


Python pkcs1.decrypt方法代碼示例

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


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

示例1: decrypt_bigfile

# 需要導入模塊: from rsa import pkcs1 [as 別名]
# 或者: from rsa.pkcs1 import decrypt [as 別名]
def decrypt_bigfile(infile, outfile, priv_key):
    """Decrypts an encrypted VARBLOCK file, writing it to 'outfile'

    .. deprecated:: 3.4
        This function was deprecated in Python-RSA version 3.4 due to security issues
        in the VARBLOCK format. See the documentation_ for more information.

    .. _documentation: https://stuvel.eu/python-rsa-doc/usage.html#working-with-big-files

    :param infile: file-like object to read the crypto in VARBLOCK format from
    :param outfile: file-like object to write the cleartext to
    :param priv_key: :py:class:`rsa.PrivateKey` to decrypt with

    """

    warnings.warn("The 'rsa.bigfile.decrypt_bigfile' function was deprecated in Python-RSA version "
                  "3.4 due to security issues in the VARBLOCK format. See "
                  "https://stuvel.eu/python-rsa-doc/usage.html#working-with-big-files "
                  "for more information.",
                  DeprecationWarning, stacklevel=2)

    if not isinstance(priv_key, key.PrivateKey):
        raise TypeError('Private key required, but got %r' % priv_key)

    for block in varblock.yield_varblocks(infile):
        cleartext = pkcs1.decrypt(block, priv_key)
        outfile.write(cleartext) 
開發者ID:Deltares,項目名稱:aqua-monitor,代碼行數:29,代碼來源:bigfile.py

示例2: decrypt_bigfile

# 需要導入模塊: from rsa import pkcs1 [as 別名]
# 或者: from rsa.pkcs1 import decrypt [as 別名]
def decrypt_bigfile(infile, outfile, priv_key):
    '''Decrypts an encrypted VARBLOCK file, writing it to 'outfile'
    
    :param infile: file-like object to read the crypto in VARBLOCK format from
    :param outfile: file-like object to write the cleartext to
    :param priv_key: :py:class:`rsa.PrivateKey` to decrypt with

    '''

    if not isinstance(priv_key, key.PrivateKey):
        raise TypeError('Private key required, but got %r' % priv_key)
    
    for block in varblock.yield_varblocks(infile):
        cleartext = pkcs1.decrypt(block, priv_key)
        outfile.write(cleartext) 
開發者ID:deadblue,項目名稱:baidupan_shell,代碼行數:17,代碼來源:bigfile.py


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