use of com.quorum.tessera.config.keys.KeyEncryptor 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.keys.KeyEncryptor 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.keys.KeyEncryptor 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.keys.KeyEncryptor 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);
}
use of com.quorum.tessera.config.keys.KeyEncryptor in project tessera by ConsenSys.
the class KeyDataUtilTest method marshalInlineKeypair.
@Test
public void marshalInlineKeypair() {
KeyEncryptor keyEncryptor = mock(KeyEncryptor.class);
KeyDataConfig keyDataConfig = mock(KeyDataConfig.class);
InlineKeypair keyPair = new InlineKeypair("PUBLIC_KEY", keyDataConfig, keyEncryptor);
KeyData result = KeyDataUtil.marshal(keyPair);
assertThat(result.getPublicKey()).isEqualTo("PUBLIC_KEY");
assertThat(result.getConfig()).isSameAs(keyDataConfig);
}
Aggregations