I am very confused about the way of sending the CA's certificate to another party. What if some hacker is monitoring the network in the moment you send a certificate to other party and hacks the public key from that certificate? He could then pretend that he is you and encrypt the messages using that public key...If anybody can explain a matter of this issue, I would be very grateful!
The public key is contained in the certificate which gets sent from the server to the client inside the TLS handshake, so that the client can check if it speaks to the correct server to prevent man in the middle attacks. The certificate is signed by the issuer CA. This signature also includes the public key.
If the public key gets replaced by an attacker the signature of the certificate will therefore be invalid. In this case certificate validation fails and the TLS handshake will be aborted. This means the attacker not also needs to replace the public key but also needs to recreate the signature of the certificate so that it gets valid again. But, to do this he would need to have the private key of a CA which is trusted by the client, i.e. needs to have either compromised such a CA to get to the private key or needs to have compromised the client to install a new trusted CA.
I assume that "the way of sending the CA's certificate to another party" is the process where you sent the CSR to the CA to be signed.
What if some hacker is monitoring the network in the moment you send a certificate to other party and hacks the public key from that certificate?
He will most likely intercept the encrypted SSL connection. No CA that deserves its name would accept a CSR from a plain unencrypted unprotected HTTP connection.
If somehow he managed to MiTM the connection, change the public key and send its own, the owner of the original certificate would receive the CA certificate, install it, see every connection failing, test the certificate, and realize they received a certificate that isn't its own. He would proceed to revoke the certificate and request another one.
It's easier to attack the CA instead. Attacking the network infrastructure, changing data in flight and change the CSR to fool the CA and the certificate owner is way harder than to exploit countless possible vulnerabilities on the CA infrastructure and issue your own counterfeit certificate.
Bonus point: managing to execute the attack you asked gives you access to one certificate. Breaching a CA gives you the power to create any certificate you want.