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


Python dsa._check_dsa_private_numbers方法代碼示例

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


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

示例1: load_dsa_private_numbers

# 需要導入模塊: from cryptography.hazmat.primitives.asymmetric import dsa [as 別名]
# 或者: from cryptography.hazmat.primitives.asymmetric.dsa import _check_dsa_private_numbers [as 別名]
def load_dsa_private_numbers(self, numbers):
        dsa._check_dsa_private_numbers(numbers)
        parameter_numbers = numbers.public_numbers.parameter_numbers

        dsa_cdata = self._lib.DSA_new()
        self.openssl_assert(dsa_cdata != self._ffi.NULL)
        dsa_cdata = self._ffi.gc(dsa_cdata, self._lib.DSA_free)

        dsa_cdata.p = self._int_to_bn(parameter_numbers.p)
        dsa_cdata.q = self._int_to_bn(parameter_numbers.q)
        dsa_cdata.g = self._int_to_bn(parameter_numbers.g)
        dsa_cdata.pub_key = self._int_to_bn(numbers.public_numbers.y)
        dsa_cdata.priv_key = self._int_to_bn(numbers.x)

        evp_pkey = self._dsa_cdata_to_evp_pkey(dsa_cdata)

        return _DSAPrivateKey(self, dsa_cdata, evp_pkey) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:19,代碼來源:backend.py

示例2: load_dsa_private_numbers

# 需要導入模塊: from cryptography.hazmat.primitives.asymmetric import dsa [as 別名]
# 或者: from cryptography.hazmat.primitives.asymmetric.dsa import _check_dsa_private_numbers [as 別名]
def load_dsa_private_numbers(self, numbers):
        dsa._check_dsa_private_numbers(numbers)
        parameter_numbers = numbers.public_numbers.parameter_numbers

        dsa_cdata = self._lib.DSA_new()
        self.openssl_assert(dsa_cdata != self._ffi.NULL)
        dsa_cdata = self._ffi.gc(dsa_cdata, self._lib.DSA_free)

        p = self._int_to_bn(parameter_numbers.p)
        q = self._int_to_bn(parameter_numbers.q)
        g = self._int_to_bn(parameter_numbers.g)
        pub_key = self._int_to_bn(numbers.public_numbers.y)
        priv_key = self._int_to_bn(numbers.x)
        self._dsa_cdata_set_values(dsa_cdata, p, q, g, pub_key, priv_key)

        evp_pkey = self._dsa_cdata_to_evp_pkey(dsa_cdata)

        return _DSAPrivateKey(self, dsa_cdata, evp_pkey) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:20,代碼來源:backend.py


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