use of org.neo4j.test.ssl.SelfSignedCertificateFactory in project neo4j by neo4j.
the class CertificatesIT method setup.
@BeforeAll
public static void setup() throws IOException, GeneralSecurityException, OperatorCreationException {
certFactory = new SelfSignedCertificateFactory();
keyFile = Files.createTempFile("key", "pem");
certFile = Files.createTempFile("key", "pem");
// make sure files are not there
Files.delete(keyFile);
Files.delete(certFile);
certFactory.createSelfSignedCertificate(certFile, keyFile, "my.domain");
util = new TransportTestUtil();
}
use of org.neo4j.test.ssl.SelfSignedCertificateFactory in project neo4j by neo4j.
the class RoutingConnectorCertificatesIT method setUp.
@BeforeAll
public static void setUp() throws IOException, GeneralSecurityException, OperatorCreationException {
certFactory = new SelfSignedCertificateFactory();
externalKeyFile = Files.createTempFile("key", "pem");
externalCertFile = Files.createTempFile("key", "pem");
// make sure files are not there
Files.delete(externalKeyFile);
Files.delete(externalCertFile);
certFactory.createSelfSignedCertificate(externalCertFile, externalKeyFile, "my.domain");
internalKeyFile = Files.createTempFile("key", "pem");
internalCertFile = Files.createTempFile("key", "pem");
// make sure files are not there
Files.delete(internalKeyFile);
Files.delete(internalCertFile);
certFactory.createSelfSignedCertificate(internalCertFile, internalKeyFile, "my.domain");
util = new TransportTestUtil();
}
use of org.neo4j.test.ssl.SelfSignedCertificateFactory in project neo4j by neo4j.
the class SslPolicyLoaderTest method setup.
@BeforeEach
void setup() throws Exception {
home = testDirectory.directory("home");
baseDir = home.resolve("certificates/default");
publicCertificateFile = baseDir.resolve("public.crt");
privateKeyFile = baseDir.resolve("private.key");
new SelfSignedCertificateFactory().createSelfSignedCertificate(publicCertificateFile, privateKeyFile, "localhost");
trustedDir = makeDir(baseDir, "trusted");
FileUtils.copyFile(publicCertificateFile, trustedDir.resolve("public.crt"));
revokedDir = makeDir(baseDir, "revoked");
}
use of org.neo4j.test.ssl.SelfSignedCertificateFactory in project neo4j by neo4j.
the class PkiUtilsTest method shouldCreateASelfSignedCertificate.
@Test
void shouldCreateASelfSignedCertificate() throws Exception {
// Given
var sslFactory = new SelfSignedCertificateFactory();
var cPath = testDirectory.homePath().resolve("certificate");
var pkPath = testDirectory.homePath().resolve("key");
// When
sslFactory.createSelfSignedCertificate(cPath, pkPath, "myhost");
// Then
// Attempt to load certificate
var certificates = PkiUtils.loadCertificates(cPath);
assertThat(certificates.length).isGreaterThan(0);
// Attempt to load private key
PrivateKey pk = PkiUtils.loadPrivateKey(pkPath, null);
assertThat(pk).isNotNull();
}
Aggregations