use of org.cloudfoundry.credhub.request.RsaGenerationParameters in project credhub by cloudfoundry-incubator.
the class RsaCredentialVersionTest method matchesGenerationParameters_returnsFalseWhenParametersDontMatch.
@Test
public void matchesGenerationParameters_returnsFalseWhenParametersDontMatch() {
when(credentialVersionData.getKeyLength()).thenReturn(2048);
RsaGenerationParameters generationParameters = new RsaGenerationParameters();
generationParameters.setKeyLength(4096);
assertThat(subject.matchesGenerationParameters(generationParameters), equalTo(false));
}
use of org.cloudfoundry.credhub.request.RsaGenerationParameters in project credhub by cloudfoundry-incubator.
the class RsaGeneratorTest method generateCredential_shouldUseTheProvidedKeyLength.
@Test
public void generateCredential_shouldUseTheProvidedKeyLength() throws Exception {
RsaGenerationParameters rsaGenerationParameters = new RsaGenerationParameters();
rsaGenerationParameters.setKeyLength(4096);
subject.generateCredential(rsaGenerationParameters);
verify(keyPairGenerator).generateKeyPair(4096);
}
use of org.cloudfoundry.credhub.request.RsaGenerationParameters in project credhub by cloudfoundry-incubator.
the class RsaGeneratorTest method generateCredential_shouldReturnAGeneratedCredential.
@Test
public void generateCredential_shouldReturnAGeneratedCredential() throws Exception {
final RsaCredentialValue rsa = subject.generateCredential(new RsaGenerationParameters());
verify(keyPairGenerator).generateKeyPair(2048);
assertThat(rsa.getPublicKey(), equalTo(CertificateFormatter.pemOf(keyPair.getPublic())));
assertThat(rsa.getPrivateKey(), equalTo(CertificateFormatter.pemOf(keyPair.getPrivate())));
}
use of org.cloudfoundry.credhub.request.RsaGenerationParameters in project credhub by cloudfoundry-incubator.
the class RsaCredentialVersionTest method matchesGenerationParameters_returnsTrueWhenParametersMatch.
@Test
public void matchesGenerationParameters_returnsTrueWhenParametersMatch() {
when(credentialVersionData.getKeyLength()).thenReturn(4096);
RsaGenerationParameters generationParameters = new RsaGenerationParameters();
generationParameters.setKeyLength(4096);
assertThat(subject.matchesGenerationParameters(generationParameters), equalTo(true));
}
Aggregations