use of org.cloudfoundry.credhub.domain.Encryptor in project credhub by cloudfoundry-incubator.
the class CredentialsHandlerTest method beforeEach.
@Before
public void beforeEach() {
Encryptor encryptor = mock(Encryptor.class);
permissionedCredentialService = mock(PermissionedCredentialService.class);
permissionCheckingService = mock(PermissionCheckingService.class);
subject = new CredentialsHandler(permissionedCredentialService);
userContext = mock(UserContext.class);
when(userContext.getActor()).thenReturn(USER);
version1 = new SshCredentialVersion(CREDENTIAL_NAME);
version1.setVersionCreatedAt(VERSION1_CREATED_AT);
version1.setEncryptor(encryptor);
version2 = new SshCredentialVersion(CREDENTIAL_NAME);
version2.setVersionCreatedAt(VERSION2_CREATED_AT);
version2.setEncryptor(encryptor);
}
use of org.cloudfoundry.credhub.domain.Encryptor in project credhub by cloudfoundry-incubator.
the class JsonViewTest method beforeEach.
@Before
public void beforeEach() {
value = new HashMap<>();
value.put("string", "something");
value.put("num", 10);
value.put("camelCase", "blabla");
serializedValue = serializeToString(value);
encryptor = mock(Encryptor.class);
uuid = UUID.randomUUID();
entity = new JsonCredentialVersion("/foo").setEncryptor(encryptor).setUuid(uuid);
when(encryptor.decrypt(any())).thenReturn(serializedValue);
}
use of org.cloudfoundry.credhub.domain.Encryptor in project credhub by cloudfoundry-incubator.
the class PasswordViewTest method beforeEach.
@Before
public void beforeEach() {
encryptor = mock(Encryptor.class);
uuid = UUID.randomUUID();
entity = new PasswordCredentialVersion("/foo").setEncryptor(encryptor).setUuid(uuid);
when(encryptor.decrypt(any())).thenReturn("fake-plaintext-value");
}
use of org.cloudfoundry.credhub.domain.Encryptor in project credhub by cloudfoundry-incubator.
the class ValueViewTest method beforeEach.
@Before
public void beforeEach() {
uuid = UUID.randomUUID();
encryptor = mock(Encryptor.class);
when(encryptor.decrypt(any())).thenReturn("fake-plaintext-value");
entity = new ValueCredentialVersion("/foo").setEncryptor(encryptor).setUuid(uuid);
}
use of org.cloudfoundry.credhub.domain.Encryptor in project credhub by cloudfoundry-incubator.
the class SshViewTest method beforeEach.
@Before
public void beforeEach() {
Encryptor encryptor = mock(Encryptor.class);
final EncryptedValue encryption = new EncryptedValue(UUID.randomUUID(), "encrypted".getBytes(), "nonce".getBytes());
when(encryptor.encrypt(TestConstants.PRIVATE_KEY_4096)).thenReturn(encryption);
when(encryptor.decrypt(encryption)).thenReturn(TestConstants.PRIVATE_KEY_4096);
entity = new SshCredentialVersion(CREDENTIAL_NAME).setEncryptor(encryptor).setPublicKey(TestConstants.SSH_PUBLIC_KEY_4096_WITH_COMMENT).setPrivateKey(TestConstants.PRIVATE_KEY_4096);
entity.setUuid(CREDENTIAL_UUID);
}
Aggregations