When there's a passphrase in the recovery, don't print "SUCCESS" before actually trying to recover with the passphrase. Also, do the recovery only once with the given passphrase, instead of also doing it without the passphrase first.
Minimize the scope of the "try" block to the actual statements that can raise the exception
Also wait till trying to use the passphrase before echoing success to the user.