The prompt that appears when a VPN client starts is easy to misread. It is not the VPN account password, it is not the password for the tunnel, and entering it does not prove the connection is secure. It unlocks one stored representation of a private key so the client can read the key material and use it to authenticate. Everything that happens after that is a different question.

Where the answer goes wrong in practice is at the edges: people assume the passphrase protects the running tunnel, or that changing it revokes a copy of the key that already leaked. Both assumptions fail, and both fail in ways that leave a credential exposed while the operator believes it was handled.

One dialog, several different secrets

A private-key passphrase decrypts a file. An account password authenticates you to a service. A PKCS#12 import password decrypts a bundle that contains a key and its certificate, and it may not be the same string as the key's own passphrase. These prompts can look almost identical, and guessing which secret goes where is how keys end up pasted into the wrong field.

The tunnel's own encryption is a fourth thing. The data channel uses session keys negotiated during the handshake; the private key's passphrase has no role in protecting individual packets. If someone can read the key file, they can attempt to guess the passphrase offline, but if they can read packets, the passphrase is irrelevant.

What the encryption on disk covers

An encrypted PEM key comes in two shapes, and the header tells you which one you have. The modern PKCS#8 form opens with -----BEGIN ENCRYPTED PRIVATE KEY-----; the legacy PEM form, still common in older OpenVPN setups, opens with -----BEGIN RSA PRIVATE KEY----- and carries Proc-Type: 4,ENCRYPTED and a DEK-Info line just below it. The file holds the private key encrypted under a key derived from your passphrase, typically through a password-based KDF with a stated iteration count or work factor. The OpenSSL pkey documentation covers the formats and the passphrase options that apply when reading one.

Two consequences follow. A weak passphrase is attackable offline at whatever rate the KDF allows, so file permissions and backup access still matter even when the file is encrypted. And an attacker who obtains only the file without the passphrase has to guess; one who obtains the file and the passphrase has the key, exactly as if it had never been encrypted.

head -3 vpn.key
openssl pkey -in vpn.key -noout -pubout
openssl pkcs12 -in bundle.p12 -info -noout

head -3 shows the header and, on a legacy file, the Proc-Type and DEK-Info lines that prove encryption; one line alone is not evidence either way. The pkey line prompts for the passphrase and prints only the public half, which proves the file and the passphrase work without exposing the private key. Do not use -text for that check: it prints the private components, privateExponent, prime1, prime2 and the rest, and that output must never be pasted anywhere, a ticket, a chat or a log. The PKCS#12 command also tells you whether the bundle has a separate MAC or encryption password, which is worth knowing before you hand it to a colleague.

What it stops protecting once the key is loaded

Unlocking is a one-way event for that process. The client asks the KDF for the key, decrypts the file, and keeps the private key in memory for as long as it needs it. From that moment the passphrase protects nothing about the running session: not the process memory, not a core dump, not a debugging session attached to the client, and not a backup of the machine taken while the key was in use.

This is the same boundary as an SSH key with a passphrase, or a password manager's unlocked vault. It raises the cost of stealing the file at rest and does nothing against malware running as your user, an authorized application that asks the client to sign, or an administrator who can read memory. Treat it as one layer, not as the control that makes a key safe to leave lying around.

Why the prompt keeps coming back

A client that asks again on every reconnect is not necessarily broken. Some clients cache the passphrase for the session, some store it in the OS keychain, and some can be pointed at a helper that supplies it, so which behavior you get depends on the client and its configuration, not on the key file.

If the repeated prompt is the actual complaint, inspect the client's caching and authentication options before removing encryption from the key. Stripping the passphrase converts a protected file into a plaintext key, and the reconnect becomes quiet at the cost of the only at-rest control you had. A better answer is usually a supported credential store with the same file permissions you would use anyway.

Loss and exposure are not the same repair

A lost passphrase cannot be recovered from the certificate. The certificate is public material that binds a name to a key; it contains no path back to the private key and no hint about the passphrase. The practical options are an authorized backup of the key, or a new identity issued through the operator's normal process. Anyone offering to "recover" the passphrase is offering to guess it.

Exposure needs a different response. Re-encrypting the same key with a new passphrase leaves the key material unchanged, so a copy that was already unlocked elsewhere still works. The repair is to revoke or replace the credential: issue a new key and certificate, distribute it, and retire the old one at the peer. Until that happens, changing the file password is housekeeping, not containment. Keep the old file out of backups only after the new identity is confirmed working, and record which serial or fingerprint replaced it.

Makomi ya ndenge moko