can man in the middle change transaction before its broadcast? i'm very new to bitcoins (started learning it today). i hope i get the question right:

i understand when a transaction is created, using my private key i sign the transaction, but i also provide the public key with it right?

if so, what denies a man in the middle to take it, re-sign using his own private key, and provide his own public key?


regular https handles this issue using a root CA, which i understand doesn't exist in bitcoins concept
encryption is usually used using the public keys, to avoid someone else changing the transaction and re-encrypt it (as it doesn't have the private key to open the data)


so, i don't quite understand what makes it secure as the bitcoin wallet creates a data that is not encrypted, and anyone else can take this data, and alter whatever it wants before it leaves the network

thanks!
In order for the transaction to be valid it has to have valid signatures from the public keys associated with the funds being transferred. It is regarded to be computationally unfeasible for a middleman to forge a signature if he does not possess the private key.

These signatures are specific to the transaction and ensure its integrity, i.e., if the transaction is modified (by replacing recipient, amount, ...) then the signature becomes invalid.

There is a small exception to the last point: a signature cannot ensure the integrity of the signature itself, hence we have some minor problems with transaction malleability in which the transaction signature can be modified, but not its effects.