Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static org.neo4j.kernel.configuration.Config aConfig(String hostname, org.neo4j.test.rule.TestDirectory testDirectory) throws java.security.GeneralSecurityException, java.io.IOException, org.bouncycastle.operator.OperatorCreationException
        public static Config AConfig(string hostname, TestDirectory testDirectory)
        {
            string random               = System.Guid.randomUUID().ToString();
            File   baseDirectory        = testDirectory.Directory("base_directory_" + random);
            File   validCertificatePath = new File(baseDirectory, "certificate.crt");
            File   validPrivateKeyPath  = new File(baseDirectory, "private.pem");
            File   revoked              = new File(baseDirectory, "revoked");
            File   trusted              = new File(baseDirectory, "trusted");

            trusted.mkdirs();
            revoked.mkdirs();
            _pkiUtils.createSelfSignedCertificate(validCertificatePath, validPrivateKeyPath, hostname);                 // Sets Subject Alternative Name(s) to hostname
            return(Config.builder().withSetting(SslPolicyConfig.base_directory, baseDirectory.ToString()).withSetting(SslPolicyConfig.trusted_dir, trusted.ToString()).withSetting(SslPolicyConfig.revoked_dir, revoked.ToString()).withSetting(SslPolicyConfig.private_key, validPrivateKeyPath.ToString()).withSetting(SslPolicyConfig.public_certificate, validCertificatePath.ToString()).withSetting(SslPolicyConfig.tls_versions, "TLSv1.2").withSetting(SslPolicyConfig.ciphers, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA").withSetting(SslPolicyConfig.client_auth, "none").withSetting(SslPolicyConfig.allow_key_generation, "false").withSetting(SslPolicyConfig.trust_all, "false").withSetting(SslPolicyConfig.verify_hostname, "true").build());
        }