It does not store the key - it simply encrypts or decrypts the key that you enter.
Here's the hex dump of the 15-character file encrypted with the key ("elephant" - try it, the content didn’t make sense ("abcdededesdasd") before I encrypted it):
0x0000: 56 69 6D 43 72 79 70 74 7E 30 31 21 95 96 C7 F6 VimCrypt~01!.... 0x0010: 75 C8 3B BF 1D BD BD 86 97 32 DA u.;......2. 0x001B:
Length 27 characters; 'VimCrypt ~ 01! is 12 characters. If you decrypt it using the wrong key (say, "pink traveler"), you will get garbage. Thus, vim does not check integrity in an encrypted file or a decrypted file.
Jonathan leffler
source share