use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method unmarshalAwsVaultKeyPair.
@Test
public void unmarshalAwsVaultKeyPair() {
KeyEncryptor keyEncryptor = mock(KeyEncryptor.class);
KeyData keyData = new KeyData();
keyData.setAwsSecretsManagerPrivateKeyId("AwsSecretsManagerPrivateKeyId");
keyData.setAwsSecretsManagerPublicKeyId("AwsSecretsManagerPublicKeyId");
AWSKeyPair result = (AWSKeyPair) KeyDataUtil.unmarshal(keyData, keyEncryptor);
assertThat(result).isNotNull();
assertThat(result.getPrivateKeyId()).isEqualTo("AwsSecretsManagerPrivateKeyId");
assertThat(result.getPublicKeyId()).isEqualTo("AwsSecretsManagerPublicKeyId");
verifyZeroInteractions(keyEncryptor);
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method unmarshalInlineKeypair.
@Test
public void unmarshalInlineKeypair() {
KeyEncryptor keyEncryptor = mock(KeyEncryptor.class);
KeyData keyData = new KeyData();
keyData.setPublicKey("PUBLICKEY");
KeyDataConfig config = mock(KeyDataConfig.class);
keyData.setConfig(config);
InlineKeypair result = (InlineKeypair) KeyDataUtil.unmarshal(keyData, keyEncryptor);
assertThat(result).isNotNull();
assertThat(result.getPublicKey()).isEqualTo("PUBLICKEY");
assertThat(result.getPrivateKeyConfig()).isSameAs(config);
verifyZeroInteractions(keyEncryptor);
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method unmarshalDirectKeyPair.
@Test
public void unmarshalDirectKeyPair() {
KeyEncryptor keyEncryptor = mock(KeyEncryptor.class);
KeyData keyData = new KeyData();
keyData.setPublicKey("PUBLICKEY");
keyData.setPrivateKey("PRIVATEKEY");
ConfigKeyPair result = KeyDataUtil.unmarshal(keyData, keyEncryptor);
assertThat(result).isNotNull().isExactlyInstanceOf(DirectKeyPair.class);
assertThat(result.getPublicKey()).isEqualTo("PUBLICKEY");
assertThat(result.getPrivateKey()).isEqualTo("PRIVATEKEY");
verifyZeroInteractions(keyEncryptor);
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method isAzure.
@Test
public void isAzure() {
KeyData keyData = new KeyData();
keyData.setAzureVaultPrivateKeyId("AzureVaultPrivateKeyId");
keyData.setAzureVaultPublicKeyId("AzureVaultPublicKeyId");
assertThat(KeyDataUtil.isAzure(keyData)).isTrue();
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method marshalHashicorpVaultKeyPair.
@Test
public void marshalHashicorpVaultKeyPair() {
HashicorpVaultKeyPair keyPair = new HashicorpVaultKeyPair("HashicorpVaultPublicKeyId", "HashicorpVaultPrivateKeyId", "HashicorpVaultSecretEngineName", "HashicorpVaultSecretName", 1);
KeyData result = KeyDataUtil.marshal(keyPair);
assertThat(result.getHashicorpVaultPublicKeyId()).isEqualTo("HashicorpVaultPublicKeyId");
assertThat(result.getHashicorpVaultPrivateKeyId()).isEqualTo("HashicorpVaultPrivateKeyId");
assertThat(result.getHashicorpVaultSecretEngineName()).isEqualTo("HashicorpVaultSecretEngineName");
assertThat(result.getHashicorpVaultSecretName()).isEqualTo("HashicorpVaultSecretName");
assertThat(result.getHashicorpVaultSecretVersion()).isEqualTo("1");
}
Aggregations