KeyStoreFactoryTests Class — spring-boot Architecture
Architecture documentation for the KeyStoreFactoryTests class in KeyStoreFactoryTests.java from the spring-boot codebase.
Entity Profile
Source Code
buildpack/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/ssl/KeyStoreFactoryTests.java lines 37–75
class KeyStoreFactoryTests {
private PemFileWriter fileWriter;
@BeforeEach
void setUp() throws IOException {
this.fileWriter = new PemFileWriter();
}
@AfterEach
void tearDown() throws IOException {
this.fileWriter.cleanup();
}
@Test
void createKeyStoreWithCertChain()
throws IOException, KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException {
Path certPath = this.fileWriter.writeFile("cert.pem", PemFileWriter.CA_CERTIFICATE, PemFileWriter.CERTIFICATE);
KeyStore keyStore = KeyStoreFactory.create(certPath, null, "test-alias");
assertThat(keyStore.containsAlias("test-alias-0")).isTrue();
assertThat(keyStore.getCertificate("test-alias-0")).isNotNull();
assertThat(keyStore.getKey("test-alias-0", new char[] {})).isNull();
assertThat(keyStore.containsAlias("test-alias-1")).isTrue();
assertThat(keyStore.getCertificate("test-alias-1")).isNotNull();
assertThat(keyStore.getKey("test-alias-1", new char[] {})).isNull();
}
@Test
void createKeyStoreWithCertChainAndRsaPrivateKey()
throws IOException, KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException {
Path certPath = this.fileWriter.writeFile("cert.pem", PemFileWriter.CA_CERTIFICATE, PemFileWriter.CERTIFICATE);
Path keyPath = this.fileWriter.writeFile("key.pem", PemFileWriter.PRIVATE_RSA_KEY);
KeyStore keyStore = KeyStoreFactory.create(certPath, keyPath, "test-alias");
assertThat(keyStore.containsAlias("test-alias")).isTrue();
assertThat(keyStore.getCertificate("test-alias")).isNotNull();
assertThat(keyStore.getKey("test-alias", new char[] {})).isNotNull();
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free