]> source.dussan.org Git - gitblit.git/commitdiff
Show a confirmation prompt on first startup of GCA if Unlimited Strength is unavailable
authorJames Moger <james.moger@gitblit.com>
Wed, 28 Nov 2012 22:54:53 +0000 (17:54 -0500)
committerJames Moger <james.moger@gitblit.com>
Wed, 28 Nov 2012 22:54:53 +0000 (17:54 -0500)
src/com/gitblit/authority/GitblitAuthority.java
src/com/gitblit/wicket/GitBlitWebApp.properties

index 59f13206239d80cf4de6c443cd92ee59e6cfe4b2..5ee6af593eb40a3a4ca4105b9f8435fbe7579b79 100644 (file)
@@ -17,6 +17,7 @@ package com.gitblit.authority;
 \r
 import java.awt.BorderLayout;\r
 import java.awt.Container;\r
+import java.awt.Desktop;\r
 import java.awt.Dimension;\r
 import java.awt.EventQueue;\r
 import java.awt.FlowLayout;\r
@@ -35,6 +36,7 @@ import java.io.FileInputStream;
 import java.io.FileWriter;\r
 import java.io.FilenameFilter;\r
 import java.io.IOException;\r
+import java.net.URI;\r
 import java.security.PrivateKey;\r
 import java.security.cert.CertificateFactory;\r
 import java.security.cert.X509Certificate;\r
@@ -296,6 +298,24 @@ public class GitblitAuthority extends JFrame implements X509Log {
                        \r
                        File caKeystore = new File(folder, X509Utils.CA_KEY_STORE);\r
                        if (!caKeystore.exists()) {\r
+                               \r
+                               if (!X509Utils.unlimitedStrength) {\r
+                                       // prompt to confirm user understands JCE Standard Strength encryption\r
+                                       int res = JOptionPane.showConfirmDialog(GitblitAuthority.this, Translation.get("gb.jceWarning"),\r
+                                                       Translation.get("gb.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);\r
+                                       if (res != JOptionPane.YES_OPTION) {\r
+                                               if (Desktop.isDesktopSupported()) {\r
+                                                       if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {\r
+                                                               try {\r
+                                                                       Desktop.getDesktop().browse(URI.create("http://www.oracle.com/technetwork/java/javase/downloads/index.html"));\r
+                                                               } catch (IOException e) {\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                               System.exit(1);\r
+                                       }\r
+                               }\r
+                               \r
                                // show certificate defaults dialog \r
                                certificateDefaultsButton.doClick();\r
                                \r
index 46dcbee84e8fa4bfa8eaa20f6e8054c1f015da7e..6ee12990fb246a0efb60f65907bf4adf9de9ea6a 100644 (file)
@@ -429,3 +429,5 @@ gb.emailCertificateBundle = email client certificate bundle
 gb.pleaseGenerateClientCertificate = Please generate a client certificate for {0}\r
 gb.clientCertificateBundleSent = Client certificate bundle for {0} sent\r
 gb.enterKeystorePassword = Please enter the Gitblit keystore password\r
+gb.warning = warning\r
+gb.jceWarning = Your Java Runtime Environment does not have the \"JCE Unlimited Strength Jurisdiction Policy\" files.\nThis will limit the length of passwords you may use to encrypt your keystores to 7 characters.\nThese policy files are an optional download from Oracle.\n\nWould you like to continue and generate the certificate infrastructure anyway?\n\nAnswering No will direct your browser to Oracle's download page so that you may download the policy files.
\ No newline at end of file