use of org.cloudfoundry.credhub.request.SshGenerationParameters in project credhub by cloudfoundry-incubator.
the class SshGeneratorTest method generateCredential_shouldReturnAGeneratedCredential.
@Test
public void generateCredential_shouldReturnAGeneratedCredential() throws Exception {
final SshCredentialValue ssh = subject.generateCredential(new SshGenerationParameters());
verify(keyPairGeneratorMock).generateKeyPair(2048);
assertThat(ssh.getPublicKey(), equalTo(CertificateFormatter.derOf((RSAPublicKey) keyPair.getPublic())));
assertThat(ssh.getPrivateKey(), equalTo(CertificateFormatter.pemOf(keyPair.getPrivate())));
}
use of org.cloudfoundry.credhub.request.SshGenerationParameters in project credhub by cloudfoundry-incubator.
the class SshCredentialVersionTest method matchesGenerationParameters_returnsTrueWhenParametersMatch.
@Test
public void matchesGenerationParameters_returnsTrueWhenParametersMatch() {
when(sshPublicKeyParser.getKeyLength()).thenReturn(4096);
when(sshPublicKeyParser.getComment()).thenReturn("some comment");
SshGenerationParameters generationParameters = new SshGenerationParameters();
generationParameters.setKeyLength(4096);
generationParameters.setSshComment("some comment");
assertThat(subject.matchesGenerationParameters(generationParameters), equalTo(true));
}
Aggregations