def decrypt_verify_and_load_for( cls: Type[BaseSignedDataTypeVar], encrypted: bytes, recipient_privkey: PrivateKey, author_verify_key: VerifyKey, expected_author: DeviceID, expected_timestamp: DateTime, **kwargs, ) -> BaseSignedDataTypeVar: """ Raises: DataError """ try: signed = recipient_privkey.decrypt_from_self(encrypted) except CryptoError as exc: raise DataError(str(exc)) from exc return cls.verify_and_load( signed, author_verify_key=author_verify_key, expected_author=expected_author, expected_timestamp=expected_timestamp, **kwargs, )
def decrypt_and_load_for(self, encrypted: bytes, recipient_privkey: PrivateKey, **kwargs) -> "BaseData": """ Raises: DataError """ try: raw = recipient_privkey.decrypt_from_self(encrypted) except CryptoError as exc: raise DataError(str(exc)) from exc return self.load(raw, **kwargs)
def decrypt_and_load_for( cls: Type[BaseDataTypeVar], encrypted: bytes, recipient_privkey: PrivateKey, **kwargs: object, ) -> BaseDataTypeVar: """ Raises: DataError """ try: raw = recipient_privkey.decrypt_from_self(encrypted) except CryptoError as exc: raise DataError(str(exc)) from exc return cls.load(raw, **kwargs)