Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I configure my VPN (let say which uses PPTP protocol), enter the server name, username and password. Then, I visit a website. Before that, my request is encrypted using AES with some key. That request is sent to the VPN. How does that VPN decrypt data? How can it know what the key is? How is that key obtained between two parties? Or is the first request is sent with my username and password, VPN checks if user exists, generates the key, and sends it back to the user? But it would be insecure to do that. Also, a different key should be created when I login via mobile.

share|improve this question

migrated from Aug 29 '13 at 20:26

This question came from our site for software developers, mathematicians and others interested in cryptography.

PPTP doesn't use encryption - it relies on being tunneled within another protocol for security. – Nick ODell Aug 29 '13 at 3:51

The precise details will depend upon the specific VPN software you use, but generally, the same cryptographic key will be pre-loaded into both ends of the VPN. It may be specified in a configuration file, or derived from a passphrase, or in some other way made available to both endpoints. That's how the VPN software on your machine encrypts data and how the VPN software on the end end can decrypt the encrypted data.

share|improve this answer

PPTP itself, as specified, does not include any encryption; but the most widely used PPTP implementation, shipped with Windows, includes a non-standard encryption layer, which turned out to be quite poorly done and thus crackable in many ways, some of them generically deadly. In this specific case, the key used for encryption was computed deterministically (through a simple hash function invocation) over the concatenation of the hashed user password, and a random nonce which was exchanged (as cleartext) during the initial authentication step.

In general, for a symmetric key to be shared between two systems, there are two choices:

  • The key is derived from an initial shared secret, which was set through some initialization procedure. This is what Microsoft was doing with PPTP, the "initial secret" being the (hash of) the user's password. The derivation can include some random values (which must be sent from one system to the other) so that a different key is generated each time.

  • A key is generated dynamically with a key agreement protocol. This is the model of SSL, and, indeed, there are VPN implementation which use SSL (e.g. OpenVPN). In order to prevent Man-in-the-Middle attacks, some sort of authentication must occur; SSL uses X.509 certificates. See this answer for some explications on how such a thing as created a shared secret out of thin air can actually work. Differences between a VPN, and a browser-to-Web-server HTTPS connection, are not relevant here: the same concepts apply.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.