[GitHub] nutch pull request #147: NUTCH-2308 SSL connection test at TestNutchAPI is i...
Github user asfgit closed the pull request at: https://github.com/apache/nutch/pull/147 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nutch pull request #147: NUTCH-2308 SSL connection test at TestNutchAPI is i...
Github user lewismc commented on a diff in the pull request: https://github.com/apache/nutch/pull/147#discussion_r76481133 --- Diff: src/test/org/apache/nutch/api/AbstractNutchAPITestBase.java --- @@ -160,6 +177,37 @@ private void initializeSSLProperties() { conf.set("restapi.auth.ssl.keypass", "password"); } + private void loadCertificate() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { +KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); +char[] password = "testpassword".toCharArray(); +String testTrustKeyStorePath = "src/test/testTrustKeyStore"; --- End diff -- Please use classloader. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nutch pull request #147: NUTCH-2308 SSL connection test at TestNutchAPI is i...
Github user lewismc commented on a diff in the pull request: https://github.com/apache/nutch/pull/147#discussion_r76481048 --- Diff: src/test/org/apache/nutch/api/AbstractNutchAPITestBase.java --- @@ -160,6 +177,37 @@ private void initializeSSLProperties() { conf.set("restapi.auth.ssl.keypass", "password"); } + private void loadCertificate() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { +KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); +char[] password = "testpassword".toCharArray(); +String testTrustKeyStorePath = "src/test/testTrustKeyStore"; +System.setProperty("javax.net.ssl.trustStore" , testTrustKeyStorePath); + +File file = new File(testTrustKeyStorePath); +InputStream localCertIn = new FileInputStream(file); + +ks.load(localCertIn, password); +localCertIn.close(); + +if (ks.containsAlias("nutch")) { + return; +} + +InputStream certIn = new FileInputStream("src/test/nutch.cer"); --- End diff -- Yes. Whenever we load resources it should most likely always be done this way. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nutch pull request #147: NUTCH-2308 SSL connection test at TestNutchAPI is i...
Github user kamaci commented on a diff in the pull request: https://github.com/apache/nutch/pull/147#discussion_r76460574 --- Diff: src/test/org/apache/nutch/api/AbstractNutchAPITestBase.java --- @@ -160,6 +177,37 @@ private void initializeSSLProperties() { conf.set("restapi.auth.ssl.keypass", "password"); } + private void loadCertificate() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { +KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); +char[] password = "testpassword".toCharArray(); +String testTrustKeyStorePath = "src/test/testTrustKeyStore"; --- End diff -- Does this break Windows? I just give the path and I think it won't be a problem. Do I miss anything? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nutch pull request #147: NUTCH-2308 SSL connection test at TestNutchAPI is i...
Github user kamaci commented on a diff in the pull request: https://github.com/apache/nutch/pull/147#discussion_r76460324 --- Diff: src/test/org/apache/nutch/api/AbstractNutchAPITestBase.java --- @@ -160,6 +177,37 @@ private void initializeSSLProperties() { conf.set("restapi.auth.ssl.keypass", "password"); } + private void loadCertificate() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { +KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); +char[] password = "testpassword".toCharArray(); +String testTrustKeyStorePath = "src/test/testTrustKeyStore"; +System.setProperty("javax.net.ssl.trustStore" , testTrustKeyStorePath); + +File file = new File(testTrustKeyStorePath); +InputStream localCertIn = new FileInputStream(file); + +ks.load(localCertIn, password); +localCertIn.close(); + +if (ks.containsAlias("nutch")) { + return; +} + +InputStream certIn = new FileInputStream("src/test/nutch.cer"); --- End diff -- Do you want me to use sth. like this.getClass().getClassLoader().getResource("nutch.cer").getFile() ? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nutch pull request #147: NUTCH-2308 SSL connection test at TestNutchAPI is i...
Github user lewismc commented on a diff in the pull request: https://github.com/apache/nutch/pull/147#discussion_r76456244 --- Diff: src/test/org/apache/nutch/api/AbstractNutchAPITestBase.java --- @@ -160,6 +177,37 @@ private void initializeSSLProperties() { conf.set("restapi.auth.ssl.keypass", "password"); } + private void loadCertificate() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { +KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); +char[] password = "testpassword".toCharArray(); +String testTrustKeyStorePath = "src/test/testTrustKeyStore"; +System.setProperty("javax.net.ssl.trustStore" , testTrustKeyStorePath); + +File file = new File(testTrustKeyStorePath); +InputStream localCertIn = new FileInputStream(file); + +ks.load(localCertIn, password); +localCertIn.close(); + +if (ks.containsAlias("nutch")) { + return; +} + +InputStream certIn = new FileInputStream("src/test/nutch.cer"); --- End diff -- Please use the classloader. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nutch pull request #147: NUTCH-2308 SSL connection test at TestNutchAPI is i...
Github user lewismc commented on a diff in the pull request: https://github.com/apache/nutch/pull/147#discussion_r76456186 --- Diff: src/test/org/apache/nutch/api/AbstractNutchAPITestBase.java --- @@ -160,6 +177,37 @@ private void initializeSSLProperties() { conf.set("restapi.auth.ssl.keypass", "password"); } + private void loadCertificate() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { +KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); +char[] password = "testpassword".toCharArray(); +String testTrustKeyStorePath = "src/test/testTrustKeyStore"; --- End diff -- This will break on Windows for sure. Please use the classloader. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] nutch pull request #147: NUTCH-2308 SSL connection test at TestNutchAPI is i...
GitHub user kamaci opened a pull request: https://github.com/apache/nutch/pull/147 NUTCH-2308 SSL connection test at TestNutchAPI is implemented. You can merge this pull request into a Git repository by running: $ git pull https://github.com/kamaci/nutch NUTCH-2308 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nutch/pull/147.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #147 commit 7282e07977a1cab340ffdd078096e3d8f1c1adc3 Author: Furkan KAMACIDate: 2016-08-25T20:54:52Z NUTCH-2308 SSL connection test at TestNutchAPI is implemented. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---