コード例 #1
0
ファイル: base.py プロジェクト: admariner/parsec-cloud
    def dump_and_encrypt_for(self, recipient_pubkey: PublicKey) -> bytes:
        """
        Raises:
            DataError
        """
        try:
            raw = self.dump()
            return recipient_pubkey.encrypt_for_self(raw)

        except CryptoError as exc:
            raise DataError(str(exc)) from exc
コード例 #2
0
ファイル: base.py プロジェクト: anthrax3/parsec-cloud
    def dump_sign_and_encrypt_for(self, author_signkey: SigningKey,
                                  recipient_pubkey: PublicKey) -> bytes:
        """
        Raises:
            DataError
        """
        try:
            signed = author_signkey.sign(self._serialize())
            return recipient_pubkey.encrypt_for_self(signed)

        except CryptoError as exc:
            raise DataError(str(exc)) from exc