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


Python _Reasons.UNSUPPORTED_SERIALIZATION屬性代碼示例

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


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

示例1: private_bytes

# 需要導入模塊: from cryptography.exceptions import _Reasons [as 別名]
# 或者: from cryptography.exceptions._Reasons import UNSUPPORTED_SERIALIZATION [as 別名]
def private_bytes(self, encoding, format, encryption_algorithm):
        if format is not serialization.PrivateFormat.PKCS8:
            raise ValueError(
                "DH private keys support only PKCS8 serialization"
            )
        if not self._backend._lib.Cryptography_HAS_EVP_PKEY_DHX:
            q = self._backend._ffi.new("BIGNUM **")
            self._backend._lib.DH_get0_pqg(self._dh_cdata,
                                           self._backend._ffi.NULL,
                                           q,
                                           self._backend._ffi.NULL)
            if q[0] != self._backend._ffi.NULL:
                raise UnsupportedAlgorithm(
                    "DH X9.42 serialization is not supported",
                    _Reasons.UNSUPPORTED_SERIALIZATION)

        return self._backend._private_key_bytes(
            encoding,
            format,
            encryption_algorithm,
            self._evp_pkey,
            self._dh_cdata
        ) 
開發者ID:deNULL,項目名稱:RemoteTree,代碼行數:25,代碼來源:dh.py

示例2: public_bytes

# 需要導入模塊: from cryptography.exceptions import _Reasons [as 別名]
# 或者: from cryptography.exceptions._Reasons import UNSUPPORTED_SERIALIZATION [as 別名]
def public_bytes(self, encoding, format):
        if format is not serialization.PublicFormat.SubjectPublicKeyInfo:
            raise ValueError(
                "DH public keys support only "
                "SubjectPublicKeyInfo serialization"
            )

        if not self._backend._lib.Cryptography_HAS_EVP_PKEY_DHX:
            q = self._backend._ffi.new("BIGNUM **")
            self._backend._lib.DH_get0_pqg(self._dh_cdata,
                                           self._backend._ffi.NULL,
                                           q,
                                           self._backend._ffi.NULL)
            if q[0] != self._backend._ffi.NULL:
                raise UnsupportedAlgorithm(
                    "DH X9.42 serialization is not supported",
                    _Reasons.UNSUPPORTED_SERIALIZATION)

        return self._backend._public_key_bytes(
            encoding,
            format,
            self,
            self._evp_pkey,
            None
        ) 
開發者ID:deNULL,項目名稱:RemoteTree,代碼行數:27,代碼來源:dh.py

示例3: parameter_bytes

# 需要導入模塊: from cryptography.exceptions import _Reasons [as 別名]
# 或者: from cryptography.exceptions._Reasons import UNSUPPORTED_SERIALIZATION [as 別名]
def parameter_bytes(self, encoding, format):
        if format is not serialization.ParameterFormat.PKCS3:
            raise ValueError(
                "Only PKCS3 serialization is supported"
            )
        if not self._backend._lib.Cryptography_HAS_EVP_PKEY_DHX:
            q = self._backend._ffi.new("BIGNUM **")
            self._backend._lib.DH_get0_pqg(self._dh_cdata,
                                           self._backend._ffi.NULL,
                                           q,
                                           self._backend._ffi.NULL)
            if q[0] != self._backend._ffi.NULL:
                raise UnsupportedAlgorithm(
                    "DH X9.42 serialization is not supported",
                    _Reasons.UNSUPPORTED_SERIALIZATION)

        return self._backend._parameter_bytes(
            encoding,
            format,
            self._dh_cdata
        ) 
開發者ID:aws-quickstart,項目名稱:quickstart-git2s3,代碼行數:23,代碼來源:dh.py

示例4: load_pem_private_key

# 需要導入模塊: from cryptography.exceptions import _Reasons [as 別名]
# 或者: from cryptography.exceptions._Reasons import UNSUPPORTED_SERIALIZATION [as 別名]
def load_pem_private_key(self, data, password):
        for b in self._filtered_backends(PEMSerializationBackend):
            return b.load_pem_private_key(data, password)

        raise UnsupportedAlgorithm(
            "This backend does not support this key serialization.",
            _Reasons.UNSUPPORTED_SERIALIZATION
        ) 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:10,代碼來源:multibackend.py

示例5: load_pem_public_key

# 需要導入模塊: from cryptography.exceptions import _Reasons [as 別名]
# 或者: from cryptography.exceptions._Reasons import UNSUPPORTED_SERIALIZATION [as 別名]
def load_pem_public_key(self, data):
        for b in self._filtered_backends(PEMSerializationBackend):
            return b.load_pem_public_key(data)

        raise UnsupportedAlgorithm(
            "This backend does not support this key serialization.",
            _Reasons.UNSUPPORTED_SERIALIZATION
        ) 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:10,代碼來源:multibackend.py

示例6: load_der_private_key

# 需要導入模塊: from cryptography.exceptions import _Reasons [as 別名]
# 或者: from cryptography.exceptions._Reasons import UNSUPPORTED_SERIALIZATION [as 別名]
def load_der_private_key(self, data, password):
        for b in self._filtered_backends(DERSerializationBackend):
            return b.load_der_private_key(data, password)

        raise UnsupportedAlgorithm(
            "This backend does not support this key serialization.",
            _Reasons.UNSUPPORTED_SERIALIZATION
        ) 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:10,代碼來源:multibackend.py

示例7: load_der_public_key

# 需要導入模塊: from cryptography.exceptions import _Reasons [as 別名]
# 或者: from cryptography.exceptions._Reasons import UNSUPPORTED_SERIALIZATION [as 別名]
def load_der_public_key(self, data):
        for b in self._filtered_backends(DERSerializationBackend):
            return b.load_der_public_key(data)

        raise UnsupportedAlgorithm(
            "This backend does not support this key serialization.",
            _Reasons.UNSUPPORTED_SERIALIZATION
        ) 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:10,代碼來源:multibackend.py


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