use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method getKeyPairTypeForInlineKeyPair.
@Test
public void getKeyPairTypeForInlineKeyPair() {
KeyData keyData = new KeyData();
keyData.setPublicKey("PUBLIC_KEY");
keyData.setConfig(new KeyDataConfig());
Class<? extends ConfigKeyPair> result = KeyDataUtil.getKeyPairTypeFor(keyData);
assertThat(result).isEqualTo(InlineKeypair.class);
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method unmarshalHashicorpVaultKeyPair.
@Test
public void unmarshalHashicorpVaultKeyPair() {
KeyEncryptor keyEncryptor = mock(KeyEncryptor.class);
KeyData keyData = new KeyData();
keyData.setHashicorpVaultPrivateKeyId("HashicorpVaultPrivateKeyId");
keyData.setHashicorpVaultPublicKeyId("HashicorpVaultPublicKeyId");
keyData.setHashicorpVaultSecretVersion("99");
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()).isEqualTo(99);
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 unmarshalUnknownKeyPair.
@Test
public void unmarshalUnknownKeyPair() {
KeyEncryptor keyEncryptor = mock(KeyEncryptor.class);
KeyData keyData = new KeyData();
UnsupportedKeyPair result = (UnsupportedKeyPair) KeyDataUtil.unmarshal(keyData, keyEncryptor);
assertThat(result).isNotNull();
verifyZeroInteractions(keyEncryptor);
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method getKeyPairTypeForFileSystemKeyPair.
@Test
public void getKeyPairTypeForFileSystemKeyPair() {
KeyData keyData = new KeyData();
keyData.setPublicKeyPath(mock(Path.class));
keyData.setPrivateKeyPath(mock(Path.class));
Class<? extends ConfigKeyPair> result = KeyDataUtil.getKeyPairTypeFor(keyData);
assertThat(result).isEqualTo(FilesystemKeyPair.class);
}
use of com.quorum.tessera.config.KeyData in project tessera by ConsenSys.
the class KeyDataUtilTest method isUnsupported.
@Test
public void isUnsupported() {
KeyData keyData = new KeyData();
assertThat(KeyDataUtil.isUnsupported(keyData)).isTrue();
}
Aggregations