A method of realising an encrypted connection to a local network comprising the following steps: - exchanging directly between a client application and a gateway of the local network a public key (K1', K2') of the client application and a public key (K3') of the gateway, before the client application connects to a VPN router; - sending by the client application and by the gateway respectively, the public key (K1', K2') of the client application and the public key (K3') of the gateway to the VPN router that establishes a relationship of the public keys (K1', K2', K3'), - connecting the gateway to the VPN router by means of an internal VPN tunnel; - verifying, by the VPN router, the gateway based on the public key (K3') of the gateway and the relationship of the public keys; - connecting the client application to the VPN router via an external VPN tunnel; - transmitting by the client application its public key (K1', K2') to the VPN router; - verifying the public key (K1', K2') of the client application based on the relationship of the public keys by the VPN router; - upon the verification of the public key (K1', K2') of the client application, routing, by the VPN router, the connection between the client application and the gateway, in accordance with the relationship of the public keys (K1', K2', K3') via the external VPN tunnel and the internal VPN tunnel; - after the routing of the communication, verifying the public key (K1', K2') of the client application by the gateway and verifying the public key (K3') of the gateway by the client application; - transmitting by the gateway a secret key of symmetrical encryption encrypted by means of the public key (K1', K2') of the client application to the client application; - obtaining, by the client application, the encrypted secret key by using a private key (K1, K2) of the client application corresponding to the public key (K1', K2') of the client application to decrypt the encrypted secret key, - exchanging encrypted packages between the local network and the client application using the secret key. - exchanging directly between a client application and a gateway of the local network a public key (K1', K2') of the client application and a public key (K3') of the gateway, before the client application connects to a VPN router; - sending by the client application and by the gateway respectively, the public key (K1', K2') of the client application and the public key (K3') of the gateway to the VPN router that establishes a relationship of the public keys (K1', K2', K3'), - connecting the gateway to the VPN router by means of an internal VPN tunnel; - verifying, by the VPN router, the gateway based on the public key (K3') of the gateway and the relationship of the public keys; - connecting the client application to the VPN router via an external VPN tunnel; - transmitting by the client application its public key (K1', K2') to the VPN router; - verifying the public key (K1', K2') of the client application based on the relationship of the public keys by the VPN router; - upon the verification of the public key (K1', K2') of the client application, routing, by the VPN router, the connection between the client application and the gateway, in accordance with the relationship of the public keys (K1', K2', K3') via the external VPN tunnel and the internal VPN tunnel; - after the routing of the communication, verifying the public key (K1', K2') of the client application by the gateway and verifying the public key (K3') of the gateway by the client application; - transmitting by the gateway a secret key of symmetrical encryption encrypted by means of the public key (K1', K2') of the client application to the client application; - obtaining, by the client application, the encrypted secret key by using a private key (K1, K2) of the client application corresponding to the public key (K1', K2') of the client application to decrypt the encrypted secret key, - exchanging encrypted packages between the local network and the client application using the secret key.