String metadata = null;
{
path.mkdirs();
KeyczarFileReader store = new KeyczarFileReader(path.getAbsolutePath());
try {
metadata = store.getMetadata();
} catch (Exception e) {
log.info("Metadata not found");
}
if (metadata == null) {
KeyMetadata kmd = new KeyMetadata(nameFlag, KeyPurpose.DECRYPT_AND_ENCRYPT, DefaultKeyType.RSA_PRIV);
GenericKeyczar.create(store, kmd);
}
}
{
KeyczarFileReader store = new KeyczarFileReader(path.getAbsolutePath());
GenericKeyczar keyczar = new GenericKeyczar(store);
for (KeyVersion version : keyczar.getVersions()) {
log.info("Local password recovery key already exists; exiting for safety");