{"action":"created","comment":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/comments/85970625","pull_request_review_id":6653421,"id":85970625,"diff_hunk":"@@ -0,0 +1,169 @@\n+/*\n+ * Copyright © 2016 Cask Data, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n+ * use this file except in compliance with the License. You may obtain a copy of\n+ * the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+ * License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+\n+package co.cask.cdap.security.tools;\n+\n+import co.cask.cdap.common.conf.Constants;\n+import co.cask.cdap.common.conf.SConfiguration;\n+import com.google.common.base.Strings;\n+import org.apache.commons.lang.time.DateUtils;\n+import sun.security.x509.AlgorithmId;\n+import sun.security.x509.CertificateAlgorithmId;\n+import sun.security.x509.CertificateIssuerName;\n+import sun.security.x509.CertificateSerialNumber;\n+import sun.security.x509.CertificateSubjectName;\n+import sun.security.x509.CertificateValidity;\n+import sun.security.x509.CertificateVersion;\n+import sun.security.x509.CertificateX509Key;\n+import sun.security.x509.X500Name;\n+import sun.security.x509.X509CertImpl;\n+import sun.security.x509.X509CertInfo;\n+\n+import java.io.ByteArrayInputStream;\n+import java.io.DataOutputStream;\n+import java.io.IOException;\n+import java.io.InputStream;\n+import java.io.OutputStream;\n+import java.math.BigInteger;\n+import java.nio.file.Files;\n+import java.nio.file.Paths;\n+import java.security.InvalidKeyException;\n+import java.security.KeyPair;\n+import java.security.KeyPairGenerator;\n+import java.security.KeyStore;\n+import java.security.KeyStoreException;\n+import java.security.NoSuchAlgorithmException;\n+import java.security.NoSuchProviderException;\n+import java.security.PrivateKey;\n+import java.security.SecureRandom;\n+import java.security.SignatureException;\n+import java.security.cert.CertificateException;\n+import java.security.cert.X509Certificate;\n+import java.util.Date;\n+import java.util.Enumeration;\n+\n+/**\n+ * Utility class with methods for generating a X.509 self signed certificate\n+ * and creating a Java key store with a self signed certificate.\n+ */\n+public class GeneratedCertKeyStoreCreator {\n+  private static final String KEY_PAIR_ALGORITHM = \"RSA\";\n+  private static final String SECURE_RANDOM_ALGORITHM = \"SHA1PRNG\";\n+  private static final String SECURE_RANDOM_PROVIDER = \"SUN\";\n+\n+  /* This is based on https://www.ietf.org/rfc/rfc1779.txt\n+     CN      CommonName\n+     L       LocalityName\n+     ST      StateOrProvinceName\n+     O       OrganizationName\n+     OU      OrganizationalUnitName\n+     C       CountryName\n+     STREET  StreetAddress\n+\n+     All fields are not required.\n+    */\n+  private static final String DISTINGUISHED_NAME = \"CN=App Fabric, L=Palo Alto, C=US\";","path":"cdap-security/src/main/java/co/cask/cdap/security/tools/GeneratedCertKeyStoreCreator.java","position":78,"original_position":78,"commit_id":"850cc0f2f219476e3d256619cff6697929b6f003","original_commit_id":"850cc0f2f219476e3d256619cff6697929b6f003","user":{"login":"sreevatsanraman","id":1148913,"avatar_url":"https://avatars.githubusercontent.com/u/1148913?v=3","gravatar_id":"","url":"https://api.github.com/users/sreevatsanraman","html_url":"https://github.com/sreevatsanraman","followers_url":"https://api.github.com/users/sreevatsanraman/followers","following_url":"https://api.github.com/users/sreevatsanraman/following{/other_user}","gists_url":"https://api.github.com/users/sreevatsanraman/gists{/gist_id}","starred_url":"https://api.github.com/users/sreevatsanraman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sreevatsanraman/subscriptions","organizations_url":"https://api.github.com/users/sreevatsanraman/orgs","repos_url":"https://api.github.com/users/sreevatsanraman/repos","events_url":"https://api.github.com/users/sreevatsanraman/events{/privacy}","received_events_url":"https://api.github.com/users/sreevatsanraman/received_events","type":"User","site_admin":false},"body":"CN=CDAP? Again related to comment about having a generic configuration/cert for all CDAP service.","created_at":"2016-11-01T16:52:15Z","updated_at":"2016-11-01T16:52:15Z","html_url":"https://github.com/caskdata/cdap/pull/7037#discussion_r85970625","pull_request_url":"https://api.github.com/repos/caskdata/cdap/pulls/7037","_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments/85970625"},"html":{"href":"https://github.com/caskdata/cdap/pull/7037#discussion_r85970625"},"pull_request":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/7037"}}},"pull_request":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/7037","id":91739583,"html_url":"https://github.com/caskdata/cdap/pull/7037","diff_url":"https://github.com/caskdata/cdap/pull/7037.diff","patch_url":"https://github.com/caskdata/cdap/pull/7037.patch","issue_url":"https://api.github.com/repos/caskdata/cdap/issues/7037","number":7037,"state":"open","locked":false,"title":"Adding SSL to app-fabric-server using a generated and self signed cer…","user":{"login":"Nishith","id":83603,"avatar_url":"https://avatars.githubusercontent.com/u/83603?v=3","gravatar_id":"","url":"https://api.github.com/users/Nishith","html_url":"https://github.com/Nishith","followers_url":"https://api.github.com/users/Nishith/followers","following_url":"https://api.github.com/users/Nishith/following{/other_user}","gists_url":"https://api.github.com/users/Nishith/gists{/gist_id}","starred_url":"https://api.github.com/users/Nishith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nishith/subscriptions","organizations_url":"https://api.github.com/users/Nishith/orgs","repos_url":"https://api.github.com/users/Nishith/repos","events_url":"https://api.github.com/users/Nishith/events{/privacy}","received_events_url":"https://api.github.com/users/Nishith/received_events","type":"User","site_admin":false},"body":"…tificate. The certificate is signed using a generated key-pair and is not supposed to be validated by the client. The primary purpose of adding this is to enable encryption between router and app-fabric.\r\n\r\nThe clients will be changed to use SSL, if it is enabled, in a followup change.","created_at":"2016-11-01T06:55:16Z","updated_at":"2016-11-01T16:52:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba6309c7cd4da5b595f2005ef6b9fe5b1226931d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/caskdata/cdap/pulls/7037/commits","review_comments_url":"https://api.github.com/repos/caskdata/cdap/pulls/7037/comments","review_comment_url":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/caskdata/cdap/issues/7037/comments","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/850cc0f2f219476e3d256619cff6697929b6f003","head":{"label":"caskdata:feature/master-ssl-server","ref":"feature/master-ssl-server","sha":"850cc0f2f219476e3d256619cff6697929b6f003","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","deployments_url":"https://api.github.com/repos/caskdata/cdap/deployments","created_at":"2014-08-02T09:00:10Z","updated_at":"2016-11-01T00:26:18Z","pushed_at":"2016-11-01T16:46:12Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":666554,"stargazers_count":141,"watchers_count":141,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":61,"mirror_url":null,"open_issues_count":23,"forks":61,"open_issues":23,"watchers":141,"default_branch":"develop"}},"base":{"label":"caskdata:develop","ref":"develop","sha":"14c2f4f81bb8d99c4445736900b57050eee22ea2","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","deployments_url":"https://api.github.com/repos/caskdata/cdap/deployments","created_at":"2014-08-02T09:00:10Z","updated_at":"2016-11-01T00:26:18Z","pushed_at":"2016-11-01T16:46:12Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":666554,"stargazers_count":141,"watchers_count":141,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":61,"mirror_url":null,"open_issues_count":23,"forks":61,"open_issues":23,"watchers":141,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/7037"},"html":{"href":"https://github.com/caskdata/cdap/pull/7037"},"issue":{"href":"https://api.github.com/repos/caskdata/cdap/issues/7037"},"comments":{"href":"https://api.github.com/repos/caskdata/cdap/issues/7037/comments"},"review_comments":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/7037/comments"},"review_comment":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/7037/commits"},"statuses":{"href":"https://api.github.com/repos/caskdata/cdap/statuses/850cc0f2f219476e3d256619cff6697929b6f003"}}}}
{"actor":{"display_login":"sreevatsanraman"}}