Search in sources :

Example 6 with Encryptor

use of com.quorum.tessera.encryption.Encryptor in project tessera by ConsenSys.

the class KaliumFactoryTest method createInstance.

@Test
public void createInstance() {
    final Encryptor result = this.kaliumFactory.create();
    assertThat(kaliumFactory.getType()).isEqualTo("CUSTOM");
    assertThat(result).isNotNull().isExactlyInstanceOf(Kalium.class);
}
Also used : Encryptor(com.quorum.tessera.encryption.Encryptor) Test(org.junit.Test)

Example 7 with Encryptor

use of com.quorum.tessera.encryption.Encryptor in project tessera by ConsenSys.

the class AWSSecretManagerKeyGeneratorTest method setUp.

@Before
public void setUp() {
    final Encryptor encryptor = mock(Encryptor.class);
    this.keyVaultService = mock(KeyVaultService.class);
    final KeyPair keyPair = new KeyPair(pub, priv);
    when(encryptor.generateNewKeys()).thenReturn(keyPair);
    awsSecretManagerKeyGenerator = new AWSSecretManagerKeyGenerator(encryptor, keyVaultService);
}
Also used : KeyVaultService(com.quorum.tessera.key.vault.KeyVaultService) KeyPair(com.quorum.tessera.encryption.KeyPair) AWSKeyPair(com.quorum.tessera.config.keypairs.AWSKeyPair) Encryptor(com.quorum.tessera.encryption.Encryptor) Before(org.junit.Before)

Example 8 with Encryptor

use of com.quorum.tessera.encryption.Encryptor 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);
}
Also used : KeyPair(com.quorum.tessera.encryption.KeyPair) FilesystemKeyPair(com.quorum.tessera.config.keypairs.FilesystemKeyPair) PasswordReader(com.quorum.tessera.passwords.PasswordReader) KeyEncryptor(com.quorum.tessera.config.keys.KeyEncryptor) Encryptor(com.quorum.tessera.encryption.Encryptor) KeyEncryptor(com.quorum.tessera.config.keys.KeyEncryptor) Before(org.junit.Before)

Example 9 with Encryptor

use of com.quorum.tessera.encryption.Encryptor in project tessera by ConsenSys.

the class ConfigGenerator method keyLookup.

private static Map<Integer, SortedMap<String, String>> keyLookup(EncryptorType encryptorType) {
    final Encryptor encryptor = transaction.utils.Utils.getEncryptor(encryptorType);
    return new HashMap<Integer, SortedMap<String, String>>() {

        {
            put(1, new TreeMap<String, String>() {

                KeyPair pair = encryptor.generateNewKeys();

                {
                    put(pair.getPublicKey().encodeToBase64(), pair.getPrivateKey().encodeToBase64());
                }
            });
            put(2, new TreeMap<String, String>() {

                KeyPair pair = encryptor.generateNewKeys();

                {
                    put(pair.getPublicKey().encodeToBase64(), pair.getPrivateKey().encodeToBase64());
                }
            });
            put(3, new TreeMap<String, String>() {

                KeyPair pair = encryptor.generateNewKeys();

                KeyPair pair2 = encryptor.generateNewKeys();

                {
                    put(pair.getPublicKey().encodeToBase64(), pair.getPrivateKey().encodeToBase64());
                    put(pair2.getPublicKey().encodeToBase64(), pair2.getPrivateKey().encodeToBase64());
                }
            });
            put(4, new TreeMap<String, String>() {

                KeyPair pair = encryptor.generateNewKeys();

                {
                    put(pair.getPublicKey().encodeToBase64(), pair.getPrivateKey().encodeToBase64());
                }
            });
        }
    };
}
Also used : KeyPair(com.quorum.tessera.encryption.KeyPair) Encryptor(com.quorum.tessera.encryption.Encryptor)

Aggregations

Encryptor (com.quorum.tessera.encryption.Encryptor)9 KeyPair (com.quorum.tessera.encryption.KeyPair)5 KeyVaultService (com.quorum.tessera.key.vault.KeyVaultService)4 Before (org.junit.Before)4 Test (org.junit.Test)3 KeyEncryptor (com.quorum.tessera.config.keys.KeyEncryptor)2 AWSKeyPair (com.quorum.tessera.config.keypairs.AWSKeyPair)1 AzureVaultKeyPair (com.quorum.tessera.config.keypairs.AzureVaultKeyPair)1 FilesystemKeyPair (com.quorum.tessera.config.keypairs.FilesystemKeyPair)1 HashicorpVaultKeyPair (com.quorum.tessera.config.keypairs.HashicorpVaultKeyPair)1 KeyEncryptorFactory (com.quorum.tessera.config.keys.KeyEncryptorFactory)1 EnvironmentVariableProvider (com.quorum.tessera.config.util.EnvironmentVariableProvider)1 EncryptorFactory (com.quorum.tessera.encryption.EncryptorFactory)1 KeyVaultServiceFactory (com.quorum.tessera.key.vault.KeyVaultServiceFactory)1 PasswordReader (com.quorum.tessera.passwords.PasswordReader)1