Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Subversion Wiki" for 
change notification.

The "MasterPassphrase" page has been changed by GregStein:
http://wiki.apache.org/subversion/MasterPassphrase?action=diff&rev1=24&rev2=25

Comment:
detail the master password validation approach

  
  The encryption algorithm requires a 16 byte key (technically, it can also be 
24 or 32 bytes), and a 16 byte 
[[http://en.wikipedia.org/wiki/Initialization_vector|initialization vector]]. 
The crypt key will be constructed as a derivation of the master password (see 
[[http://en.wikipedia.org/wiki/PBKDF2|PBKDF2]]). PBKDF2 requires a 64 bit salt. 
The IV is a random 16 byte value. The salt and IV will be stored within the 
block of data encrypted by the master password. The master password decrypts 
that data block, uses the salt to generate the (de)crypt key, then pairs it 
with the IV to decrypt the target password.
  
- To provide master passphrase validation (for the purposes of changing 
passwords, for example), we'll store the master passphrase -- encrypted using 
itself.  Verification of the master passphrase being tested then simply 
involves using it to decrypt the stored encrypted version of the real master 
passphrase and checking that the resulting plaintext matches the tested input.
+ To provide master passphrase validation (for the purposes of changing 
passwords, for example), we'll do the following:
+ {{{
+     stuff = generate_random(len=32)
+     IV = generate_random(len=16)
+     salt = generate_random(len=8)
+     check_value = sha1(stuff)
+     encrypted = aes256cbc_encrypt(stuff, IV, PBKDF2(master, salt))
+     save(encrypted, IV, salt, check_value)
+ 
+     ...
+ 
+     encrypted, IV, salt, check_value = load()
+     stuff = aes256cbc_decrypt(encrypted, IV, PBKDF2(master, salt))
+     valid = sha1(stuff) == check_value
+ }}}
+ 
+ Note that the above algorithm is similar to how we actually store target 
passwords (substitute the password for `stuff` with appropriate prefixing and 
padding).
  
  == Benefits ==
   * Centralization:  Rather than spread repository credentials cross a variety 
of stores (on-disk, keystores, etc.), we return to a single, easy-to-manage 
storage solution:  the on-disk store in {{{~/.subversion/auth/}}}

Reply via email to