Search in sources :

Example 11 with KeyData

use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.

the class KeyDataUtilTest method isInline.

@Test
public void isInline() {
    KeyData keyData = new KeyData();
    keyData.setPublicKey("PUBLICKEY");
    keyData.setConfig(mock(KeyDataConfig.class));
    assertThat(KeyDataUtil.isInline(keyData)).isTrue();
}
Also used : KeyDataConfig(com.quorum.tessera.config.KeyDataConfig) KeyData(com.quorum.tessera.config.KeyData) PrivateKeyData(com.quorum.tessera.config.PrivateKeyData) Test(org.junit.Test)

Example 12 with KeyData

use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.

the class KeyDataUtilTest method unmarshalFilesystemKeyPair.

@Test
public void unmarshalFilesystemKeyPair() {
    KeyEncryptor keyEncryptor = mock(KeyEncryptor.class);
    KeyData keyData = new KeyData();
    Path privateKeyPath = mock(Path.class);
    Path publicKeyPath = mock(Path.class);
    keyData.setPrivateKeyPath(privateKeyPath);
    keyData.setPublicKeyPath(publicKeyPath);
    FilesystemKeyPair result = (FilesystemKeyPair) KeyDataUtil.unmarshal(keyData, keyEncryptor);
    assertThat(result).isNotNull();
    assertThat(result.getPrivateKeyPath()).isSameAs(privateKeyPath);
    assertThat(result.getPublicKeyPath()).isSameAs(publicKeyPath);
    verifyZeroInteractions(keyEncryptor);
}
Also used : Path(java.nio.file.Path) KeyEncryptor(com.quorum.tessera.config.keys.KeyEncryptor) KeyData(com.quorum.tessera.config.KeyData) PrivateKeyData(com.quorum.tessera.config.PrivateKeyData) Test(org.junit.Test)

Example 13 with KeyData

use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.

the class KeyDataUtilTest method isFilesystem.

@Test
public void isFilesystem() {
    KeyData keyData = new KeyData();
    keyData.setPublicKeyPath(mock(Path.class));
    keyData.setPrivateKeyPath(mock(Path.class));
    assertThat(KeyDataUtil.isFileSystem(keyData)).isTrue();
}
Also used : Path(java.nio.file.Path) KeyData(com.quorum.tessera.config.KeyData) PrivateKeyData(com.quorum.tessera.config.PrivateKeyData) Test(org.junit.Test)

Example 14 with KeyData

use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.

the class KeyDataUtilTest method getKeyPairTypeForAwsVaultKeyPair.

@Test
public void getKeyPairTypeForAwsVaultKeyPair() {
    KeyData keyData = new KeyData();
    keyData.setAwsSecretsManagerPrivateKeyId("AWS_PRIVATE_KEY");
    keyData.setAwsSecretsManagerPublicKeyId("AWS_PUBLIC_KEY");
    Class<? extends ConfigKeyPair> result = KeyDataUtil.getKeyPairTypeFor(keyData);
    assertThat(result).isEqualTo(AWSKeyPair.class);
}
Also used : KeyData(com.quorum.tessera.config.KeyData) PrivateKeyData(com.quorum.tessera.config.PrivateKeyData) Test(org.junit.Test)

Example 15 with KeyData

use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.

the class KeyDataUtilTest method isHashicorp.

@Test
public void isHashicorp() {
    KeyData keyData = new KeyData();
    keyData.setHashicorpVaultPublicKeyId("HashicorpVaultPublicKeyId");
    keyData.setHashicorpVaultPrivateKeyId("HashicorpVaultPrivateKeyId");
    keyData.setHashicorpVaultSecretName("HashicorpVaultSecretName");
    keyData.setHashicorpVaultSecretEngineName("HashicorpVaultSecretEngineName");
    assertThat(KeyDataUtil.isHashicorp(keyData)).isTrue();
}
Also used : KeyData(com.quorum.tessera.config.KeyData) PrivateKeyData(com.quorum.tessera.config.PrivateKeyData) Test(org.junit.Test)

Aggregations

KeyData (com.quorum.tessera.config.KeyData)34 Test (org.junit.Test)32 PrivateKeyData (com.quorum.tessera.config.PrivateKeyData)31 KeyEncryptor (com.quorum.tessera.config.keys.KeyEncryptor)10 KeyDataConfig (com.quorum.tessera.config.KeyDataConfig)7 Path (java.nio.file.Path)7 Config (com.quorum.tessera.config.Config)1 KeyConfiguration (com.quorum.tessera.config.KeyConfiguration)1 DirectKeyPair (com.quorum.tessera.config.keypairs.DirectKeyPair)1 FilesystemKeyPair (com.quorum.tessera.config.keypairs.FilesystemKeyPair)1 KeyPair (com.quorum.tessera.encryption.KeyPair)1 ArrayList (java.util.ArrayList)1