use of com.quorum.tessera.passwords.PasswordReader 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);
}
}
use of com.quorum.tessera.passwords.PasswordReader in project tessera by ConsenSys.
the class FileKeyGeneratorTest method init.
@Before
public void init() {
this.keyPair = new KeyPair(PublicKey.from(PUBLIC_KEY.getBytes(UTF_8)), PrivateKey.from(PRIVATE_KEY.getBytes(UTF_8)));
this.encryptor = mock(Encryptor.class);
this.keyEncryptor = mock(KeyEncryptor.class);
this.passwordReader = mock(PasswordReader.class);
when(passwordReader.requestUserPassword()).thenReturn(new char[0]);
this.generator = new FileKeyGenerator(encryptor, keyEncryptor, passwordReader);
}
Aggregations