use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method getKeyPairTypeForDirectKeyPair.
@Test
public void getKeyPairTypeForDirectKeyPair() {
KeyData keyData = new KeyData();
keyData.setPrivateKey("PRIVATE_KEY");
keyData.setPublicKey("PUBLIC_KEY");
Class<? extends ConfigKeyPair> result = KeyDataUtil.getKeyPairTypeFor(keyData);
assertThat(result).isEqualTo(DirectKeyPair.class);
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method isDirect.
@Test
public void isDirect() {
KeyData keyData = new KeyData();
keyData.setPublicKey("PUBLICKEY");
keyData.setPrivateKey("PRIVATEKEY");
assertThat(KeyDataUtil.isDirect(keyData)).isTrue();
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method unmarshalHashicorpVaultKeyPairNoSecretVersionDefined.
@Test
public void unmarshalHashicorpVaultKeyPairNoSecretVersionDefined() {
KeyEncryptor keyEncryptor = mock(KeyEncryptor.class);
KeyData keyData = new KeyData();
keyData.setHashicorpVaultPrivateKeyId("HashicorpVaultPrivateKeyId");
keyData.setHashicorpVaultPublicKeyId("HashicorpVaultPublicKeyId");
keyData.setHashicorpVaultSecretName("HashicorpSecretName");
keyData.setHashicorpVaultSecretEngineName("HashicorpVaultSecretEngineName");
HashicorpVaultKeyPair result = (HashicorpVaultKeyPair) KeyDataUtil.unmarshal(keyData, keyEncryptor);
assertThat(result).isNotNull();
assertThat(result.getPrivateKeyId()).isEqualTo("HashicorpVaultPrivateKeyId");
assertThat(result.getPublicKeyId()).isEqualTo("HashicorpVaultPublicKeyId");
assertThat(result.getSecretVersion()).isZero();
assertThat(result.getSecretEngineName()).isEqualTo("HashicorpVaultSecretEngineName");
assertThat(result.getSecretName()).isEqualTo("HashicorpSecretName");
verifyZeroInteractions(keyEncryptor);
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method getKeyPairTypeForAzureVaultKeyPair.
@Test
public void getKeyPairTypeForAzureVaultKeyPair() {
KeyData keyData = new KeyData();
keyData.setAzureVaultPublicKeyId("AZURE_PUBLIC_ID");
keyData.setAzureVaultPrivateKeyId("AZURE_PRIVATE_ID");
Class<? extends ConfigKeyPair> result = KeyDataUtil.getKeyPairTypeFor(keyData);
assertThat(result).isEqualTo(AzureVaultKeyPair.class);
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method marshalAzureVaultKeyPair.
@Test
public void marshalAzureVaultKeyPair() {
AzureVaultKeyPair configKeyPair = new AzureVaultKeyPair("PUBLIC_KEY_ID", "PRIVATE_KEY_ID", "PUBLIC_KEY_VERSION", "PRIVATE_KEY_VERSION");
KeyData result = KeyDataUtil.marshal(configKeyPair);
assertThat(result.getAzureVaultPrivateKeyId()).isEqualTo("PRIVATE_KEY_ID");
assertThat(result.getAzureVaultPublicKeyId()).isEqualTo("PUBLIC_KEY_ID");
assertThat(result.getAzureVaultPrivateKeyVersion()).isEqualTo("PRIVATE_KEY_VERSION");
assertThat(result.getAzureVaultPublicKeyVersion()).isEqualTo("PUBLIC_KEY_VERSION");
}
Aggregations