diff options
Diffstat (limited to 'base/console/src/com/netscape/admin/certsrv/connection')
8 files changed, 72 insertions, 72 deletions
diff --git a/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java b/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java index acb023132..090b16e1d 100644 --- a/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java +++ b/base/console/src/com/netscape/admin/certsrv/connection/AdminConnection.java @@ -45,7 +45,7 @@ public class AdminConnection { *==========================================================*/ public static int NO_TIMEOUT = 0; public static int DEFAULT_TIMEOUT = 600000; //600 sec - + private IConnectionFactory mFactory= null; private IConnection mConn = null; private IAuthenticator mAuth = null; @@ -80,7 +80,7 @@ public class AdminConnection { IConnectionFactory factory, String host, int port, String path) { if (mPM == null) { - mPM = new FilePreferenceManager(Framework.IDENTIFIER, + mPM = new FilePreferenceManager(Framework.IDENTIFIER, Framework.VERSION); } Preferences p = mPM.getPreferences( @@ -88,7 +88,7 @@ public class AdminConnection { int timeout = p.getInt("CMSConnTimeout", 600000); setDefaultTimeout(timeout); setCurrentTimeout(timeout); - Debug.println("AdminConnection: " + timeout + " " + + Debug.println("AdminConnection: " + timeout + " " + mPM.getClass().getName()); mAuth = auth; @@ -117,7 +117,7 @@ public class AdminConnection { boolean enableKeepAlive, String host, int port, String path) { if (mPM == null) { - mPM = new FilePreferenceManager(Framework.IDENTIFIER, + mPM = new FilePreferenceManager(Framework.IDENTIFIER, Framework.VERSION); } Preferences p = mPM.getPreferences( @@ -125,7 +125,7 @@ public class AdminConnection { int timeout = p.getInt("CMSConnTimeout", 600000); setDefaultTimeout(timeout); setCurrentTimeout(timeout); - Debug.println("AdminConnection: " + timeout + " " + + Debug.println("AdminConnection: " + timeout + " " + mPM.getClass().getName()); mAuth = auth; @@ -172,14 +172,14 @@ public class AdminConnection { b64.append('\n'); return b64.toString(); - } + } /*========================================================== * public methods *==========================================================*/ /** - * Set the listener. + * Set the listener. */ public void setConnectionListener(IConnectionListener l) { mConnectionListener = l; @@ -217,7 +217,7 @@ public class AdminConnection { * @param timeout time in ms */ public void setCurrentTimeout(int timeout) { - mCurrentTimeout = timeout; + mCurrentTimeout = timeout; } @@ -514,7 +514,7 @@ public class AdminConnection { throw new EAdminException(response.getErrorMessage(), true); } - public void validate(String dest, String scope, NameValuePairs pairs) + public void validate(String dest, String scope, NameValuePairs pairs) throws EAdminException { Request request = new Request(mPath + "/" + dest); request.set(Constants.OP_TYPE, OpDef.OP_VALIDATE); @@ -577,7 +577,7 @@ public class AdminConnection { return; } else if (response.getReturnCode() == Response.RESTART) { mConnectionListener.restartCallback(); - return; + return; } throw new EAdminException(response.getErrorMessage(), true); } @@ -661,17 +661,17 @@ public class AdminConnection { } try { - return processRequest(request, useGET); + return processRequest(request, useGET); //all errors will set the connection to null //to force re-connection and avoid null ptr exception } catch (Exception e) { retryConnection(); - + try { return processRequest(request, useGET); } catch (InterruptedIOException ex) { - + //timeout occurred mConn = null; @@ -681,7 +681,7 @@ public class AdminConnection { } catch (SocketException ex) { mConn = null; throw new EAdminException(CMSAdminResources.SERVER_UNREACHABLE, false); - } catch (IOException ex) { + } catch (IOException ex) { if (Debug.isEnabled()) { ex.printStackTrace(); } @@ -736,12 +736,12 @@ public class AdminConnection { } sb.append("Content-length: " + sb1.toString().length() + "\n"); } - + sb.append("Pragma: no-cache\n"); if (mIsKeepAlive) { sb.append("Connection: Keep-Alive\n"); } - + if (mAuthType.equals("") || mAuthType.equals("pwd")) { BasicAuthenticator auth = (BasicAuthenticator)mAuth; // sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder(); @@ -761,7 +761,7 @@ public class AdminConnection { sb.append(sb1.toString()); } //Debug.println(sb.toString()); - + //System.out.println("AdminConnection: sendRequest() - sending"); int timeout = mDefaultTimeout; if (mCurrentTimeout > mDefaultTimeout) @@ -770,18 +770,18 @@ public class AdminConnection { mConn.sendRequest(sb.toString()); Response resp = new Response(mConn.getResponse()); - + if (!mIsKeepAlive) { mConn.disconnect(); mConn = null; } - + //set time out back to original mConn.setSoTimeout(mDefaultTimeout); mCurrentTimeout = mDefaultTimeout; return resp; } - + private void checkParams(String dest,String scope,String id) { NameValuePairs pairs = new NameValuePairs(); diff --git a/base/console/src/com/netscape/admin/certsrv/connection/BasicAuthenticator.java b/base/console/src/com/netscape/admin/certsrv/connection/BasicAuthenticator.java index 1d3796968..f0c7d5f0e 100644 --- a/base/console/src/com/netscape/admin/certsrv/connection/BasicAuthenticator.java +++ b/base/console/src/com/netscape/admin/certsrv/connection/BasicAuthenticator.java @@ -39,7 +39,7 @@ public class BasicAuthenticator implements IAuthenticator { public String getUserid() { return mUserid; } - + public String getPassword() { return mPassword; } @@ -47,7 +47,7 @@ public class BasicAuthenticator implements IAuthenticator { public void setUserId(String userid) { mUserid = userid; } - + public void setPassword(String password) { mPassword = password; } diff --git a/base/console/src/com/netscape/admin/certsrv/connection/IConnection.java b/base/console/src/com/netscape/admin/certsrv/connection/IConnection.java index 0643e50eb..3e4f76c1b 100644 --- a/base/console/src/com/netscape/admin/certsrv/connection/IConnection.java +++ b/base/console/src/com/netscape/admin/certsrv/connection/IConnection.java @@ -45,11 +45,11 @@ public interface IConnection { * Close the connection */ public void disconnect(); - + /** * SetTimeout */ public void setSoTimeout(int timeout) throws SocketException; - - + + } diff --git a/base/console/src/com/netscape/admin/certsrv/connection/JSSConnection.java b/base/console/src/com/netscape/admin/certsrv/connection/JSSConnection.java index 27292b3d9..e606cd5c4 100644 --- a/base/console/src/com/netscape/admin/certsrv/connection/JSSConnection.java +++ b/base/console/src/com/netscape/admin/certsrv/connection/JSSConnection.java @@ -48,7 +48,7 @@ import java.awt.*; * @author Christine Ho * @version $Revision$, $Date$ */ -public class JSSConnection implements IConnection, SSLCertificateApprovalCallback, +public class JSSConnection implements IConnection, SSLCertificateApprovalCallback, SSLClientCertificateSelectionCallback { /*========================================================== @@ -92,7 +92,7 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac UtilConsoleGlobals.initJSS(); cf = UtilConsoleGlobals.getX509CertificateFactory(); try { - cryptoManager = CryptoManager.getInstance(); + cryptoManager = CryptoManager.getInstance(); } catch (Exception e) { } @@ -100,19 +100,19 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac // to get the ciphers SSLSocket.enableSSL2Default(false); SSLSocket.enableSSL3Default(true); - int TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = 0xC005; - int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00A; + int TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = 0xC005; + int TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00A; int ciphers[] = SSLSocket.getImplementedCipherSuites(); for (int i = 0; ciphers != null && i < ciphers.length; i++) { // make sure SSLv2 ciphers are not enabled if ((ciphers[i] & 0xfff0) !=0xff00) { - Debug.println("JSSConnection Debug: non-SSL2 NSS Cipher Supported '0x" + - Integer.toHexString(ciphers[i]) + "'"); + Debug.println("JSSConnection Debug: non-SSL2 NSS Cipher Supported '0x" + + Integer.toHexString(ciphers[i]) + "'"); SSLSocket.setCipherPreferenceDefault(ciphers[i], true); } else { - Debug.println("JSSConnection Debug: SSL2 (turned off) NSS Cipher Supported '0x" + - Integer.toHexString(ciphers[i]) + "'"); + Debug.println("JSSConnection Debug: SSL2 (turned off) NSS Cipher Supported '0x" + + Integer.toHexString(ciphers[i]) + "'"); SSLSocket.setCipherPreferenceDefault(ciphers[i], false); } @@ -192,12 +192,12 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac if (!(promptForTrustDialog.isAcceptedForOneSession())) { try { String nickname = serverCert.getNickname(); - - CryptoToken internalToken = + + CryptoToken internalToken = cryptoManager.getInternalKeyStorageToken(); if (!internalToken.passwordIsInitialized()) { - InitPasswordDialog initPasswordDialog = + InitPasswordDialog initPasswordDialog = new InitPasswordDialog(internalToken); initPasswordDialog.setVisible(true); if (initPasswordDialog.isCancel()) { @@ -223,11 +223,11 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac mCertAccepted = false; return false; } - InternalCertificate internalCert = - cryptoManager.importCertToPerm(serverCert, + InternalCertificate internalCert = + cryptoManager.importCertToPerm(serverCert, (nickname==null)?serverCert.getSubjectDN().toString():nickname); internalCert.setSSLTrust( - org.mozilla.jss.crypto.InternalCertificate.TRUSTED_PEER | + org.mozilla.jss.crypto.InternalCertificate.TRUSTED_PEER | org.mozilla.jss.crypto.InternalCertificate.VALID_PEER); } catch (Exception e) { mServerCertImported = false; @@ -236,7 +236,7 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac e.printStackTrace(); } return false; - } + } } } @@ -258,7 +258,7 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac public boolean isClientAuth() { return mClientAuth; } - + public boolean isCertAccepted() { return mCertAccepted; } @@ -271,8 +271,8 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac return mServerCertImported; } - public String select(Vector nicknames) - { + public String select(Vector nicknames) + { selectCertDialog = null; mClientAuth = true; if (nicknames == null || nicknames.size() == 0) { @@ -312,11 +312,11 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac abort = true; throw new PasswordCallback.GiveUpException(); } - + return getPasswordDialog.getPassword(); } - public Password getPasswordAgain(PasswordCallbackInfo info) + public Password getPasswordAgain(PasswordCallbackInfo info) throws GiveUpException { @@ -445,9 +445,9 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac */ public void setSoTimeout(int timeout) throws SocketException { //System.out.println("JSSConnection: setSoTimeout() - "+timeout); - s.setSoTimeout(timeout); + s.setSoTimeout(timeout); } - + /*========================================================== * private methods *==========================================================*/ @@ -465,12 +465,12 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac readBody(); } - private int readLineFromStream(InputStream is, byte line[], + private int readLineFromStream(InputStream is, byte line[], int startpos, int len) throws IOException { //return is.readLine(line, startpos, len); int pos = startpos; int count = 0; - while (len > 0) + while (len > 0) { int nRead = httpIn.read(line, pos, 1); if (nRead == -1) @@ -581,7 +581,7 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac CryptoToken mToken; boolean tokenPasswdInit = true; boolean pwdSame = true; - + public InitPasswordDialog(CryptoToken token) { super(null,"",true, OK|CANCEL); setMinimumSize(300, 150); @@ -636,7 +636,7 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac mToken.initPassword(null, getPassword()); dispose(); } catch (Exception e) { - tokenPasswdInit = false; + tokenPasswdInit = false; } } @@ -653,7 +653,7 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac pwd.grabFocus(); super.setVisible(visible); } - + public Password getPassword() { Password jssPwd = new Password(pwd.getText().toCharArray()); return jssPwd; @@ -663,7 +663,7 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac class GetPasswordDialog extends AbstractDialog { MultilineLabel enterPwdLabel = new MultilineLabel(); - protected ResourceBundle mResource = + protected ResourceBundle mResource = ResourceBundle.getBundle(CMSAdminResources.class.getName()); SingleBytePasswordField pwd; public GetPasswordDialog() { @@ -694,7 +694,7 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac pwd.grabFocus(); super.setVisible(visible); } - + public void setPasswordInfo(PasswordCallbackInfo info, boolean getPwdAgain) { if (getPwdAgain) enterPwdLabel.setText(mResource.getString( @@ -756,6 +756,6 @@ public class JSSConnection implements IConnection, SSLCertificateApprovalCallbac return certList.getSelectedItem().toString(); } - } + } } diff --git a/base/console/src/com/netscape/admin/certsrv/connection/PromptForTrustDialog.java b/base/console/src/com/netscape/admin/certsrv/connection/PromptForTrustDialog.java index 868eccc1b..59ce0eb33 100644 --- a/base/console/src/com/netscape/admin/certsrv/connection/PromptForTrustDialog.java +++ b/base/console/src/com/netscape/admin/certsrv/connection/PromptForTrustDialog.java @@ -273,21 +273,21 @@ public class PromptForTrustDialog extends AbstractDialog implements SuiConstants private JPanel createActionButtons() { JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); - + accept = JButtonFactory.create( mResource.getString("SSLCLIENT_TRUST_DIALOG_ACCEPT"), buttonActionListener, "ACCEPT"); accept.registerKeyboardAction(buttonActionListener, "ACCEPT", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); - + JButton reject = JButtonFactory.create( mResource.getString("SSLCLIENT_TRUST_DIALOG_REJECT"), buttonActionListener, "REJECT"); reject.registerKeyboardAction(buttonActionListener, "REJECT", KeyStroke.getKeyStroke(KeyEvent.VK_R, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); - + JButton viewCert = JButtonFactory.create( mResource.getString("SSLCLIENT_TRUST_DIALOG_VIEWCERT"), buttonActionListener, "VIEWCERT"); viewCert.registerKeyboardAction(buttonActionListener, "VIEWCERT", diff --git a/base/console/src/com/netscape/admin/certsrv/connection/Request.java b/base/console/src/com/netscape/admin/certsrv/connection/Request.java index 8ed61e998..eb134b5a3 100644 --- a/base/console/src/com/netscape/admin/certsrv/connection/Request.java +++ b/base/console/src/com/netscape/admin/certsrv/connection/Request.java @@ -22,7 +22,7 @@ import java.util.*; /** * A class represents a connection to certificate server. - * + * * @author thomask * @author Jack Pan-Chen * @version $Revision$, $Date$ @@ -30,10 +30,10 @@ import java.util.*; public class Request { private String mPrefix = null; - + //internal structure is changed to vector to maintain //the ordering - + private Vector mName = new Vector(); private Vector mValue = new Vector(); @@ -55,14 +55,14 @@ public class Request { try { return (String) mValue.elementAt(i); } catch (ArrayIndexOutOfBoundsException e) { - return ""; + return ""; } } public Enumeration getElements() { return mName.elements(); } - + public void removeAll() { mName.removeAllElements(); mValue.removeAllElements(); diff --git a/base/console/src/com/netscape/admin/certsrv/connection/Response.java b/base/console/src/com/netscape/admin/certsrv/connection/Response.java index bbb511443..57958a28b 100644 --- a/base/console/src/com/netscape/admin/certsrv/connection/Response.java +++ b/base/console/src/com/netscape/admin/certsrv/connection/Response.java @@ -39,10 +39,10 @@ public class Response { private int mRetcode; private String mErrorMsg; - + //internal structure is changed to vector to maintain //the ordering - + private Vector mName = new Vector(); private Vector mValue = new Vector(); @@ -70,7 +70,7 @@ public class Response { } if (mContents != null) { String resultStr = new String(mContents); - StringTokenizer st = new StringTokenizer(resultStr, + StringTokenizer st = new StringTokenizer(resultStr, "&"); while (st.hasMoreTokens()) { String p = st.nextToken(); @@ -86,12 +86,12 @@ public class Response { } } - public int getReturnCode() { - return mRetcode; + public int getReturnCode() { + return mRetcode; } - public String getErrorMessage() { - return mErrorMsg; + public String getErrorMessage() { + return mErrorMsg; } /** @@ -126,7 +126,7 @@ public class Response { try { value = (String) mValue.elementAt(i); } catch (ArrayIndexOutOfBoundsException e) { - value = ""; + value = ""; } return value; } diff --git a/base/console/src/com/netscape/admin/certsrv/connection/SSLConnectionFactory.java b/base/console/src/com/netscape/admin/certsrv/connection/SSLConnectionFactory.java index 7c74a239d..86f7b998e 100644 --- a/base/console/src/com/netscape/admin/certsrv/connection/SSLConnectionFactory.java +++ b/base/console/src/com/netscape/admin/certsrv/connection/SSLConnectionFactory.java @@ -74,7 +74,7 @@ public class SSLConnectionFactory implements IConnectionFactory { if (mType.equals(JSS_CONNECTION)) return new JSSConnection(host, port); - return new JSSConnection(host, port); + return new JSSConnection(host, port); //return new SSLConnection(host, port); } |