Search in sources :

Example 1 with KeyEncryptorFactory

use of com.quorum.tessera.config.keys.KeyEncryptorFactory in project tessera by ConsenSys.

the class KeyUpdateCommandFactory method create.

@Override
public <K> K create(Class<K> cls) throws Exception {
    try {
        if (cls != KeyUpdateCommand.class) {
            throw new RuntimeException(this.getClass().getSimpleName() + " cannot create instance of type " + cls.getSimpleName());
        }
        KeyEncryptorFactory keyEncryptorFactory = KeyEncryptorFactory.newFactory();
        PasswordReader passwordReader = PasswordReaderFactory.create();
        return (K) new KeyUpdateCommand(keyEncryptorFactory, passwordReader);
    } catch (Exception e) {
        // fallback if missing
        return CommandLine.defaultFactory().create(cls);
    }
}
Also used : PasswordReader(com.quorum.tessera.passwords.PasswordReader) KeyEncryptorFactory(com.quorum.tessera.config.keys.KeyEncryptorFactory)

Aggregations

KeyEncryptorFactory (com.quorum.tessera.config.keys.KeyEncryptorFactory)1 PasswordReader (com.quorum.tessera.passwords.PasswordReader)1