billbarker 02/04/28 17:05:32 Modified: util/java/org/apache/tomcat/util/net JSSESupport.java PureTLSSupport.java SSLSupport.java Log: Adding support for KeySize for PureTLS. Per Eric, this is the symmetric key (same as JSSE). If the servlet spec people can decide on which one they mean, we can change it. Revision Changes Path 1.3 +0 -36 jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/JSSESupport.java Index: JSSESupport.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/JSSESupport.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- JSSESupport.java 13 Apr 2002 05:34:11 -0000 1.2 +++ JSSESupport.java 29 Apr 2002 00:05:32 -0000 1.3 @@ -82,21 +82,6 @@ */ class JSSESupport implements SSLSupport { - /** - * A mapping table to determine the number of effective bits in the key - * when using a cipher suite containing the specified cipher name. The - * underlying data came from the TLS Specification (RFC 2246), Appendix C. - */ - protected static final CipherData ciphers[] = { - new CipherData("_WITH_NULL_", 0), - new CipherData("_WITH_IDEA_CBC_", 128), - new CipherData("_WITH_RC2_CBC_40_", 40), - new CipherData("_WITH_RC4_40_", 40), - new CipherData("_WITH_RC4_128_", 128), - new CipherData("_WITH_DES40_CBC_", 40), - new CipherData("_WITH_DES_CBC_", 56), - new CipherData("_WITH_3DES_EDE_CBC_", 168) - }; private SSLSocket ssl; @@ -195,24 +180,3 @@ } } -// ------------------------------------------------------------ Private Classes - - -/** - * Simple data class that represents the cipher being used, along with the - * corresponding effective key size. The specified phrase must appear in the - * name of the cipher suite to be recognized. - */ - -final class CipherData { - - String phrase = null; - - int keySize = 0; - - public CipherData(String phrase, int keySize) { - this.phrase = phrase; - this.keySize = keySize; - } - -} 1.4 +16 -7 jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PureTLSSupport.java Index: PureTLSSupport.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PureTLSSupport.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- PureTLSSupport.java 13 Apr 2002 06:01:52 -0000 1.3 +++ PureTLSSupport.java 29 Apr 2002 00:05:32 -0000 1.4 @@ -126,14 +126,23 @@ return chain; } - public Integer getKeySize() + /** + * Lookup the symmetric key size. + */ + public Integer getKeySize() throws IOException { - /* - int cs = ssl.getCipherSuite(); - int ks = SSLCipherSuite.findCipherSuite(cs).getCipherKeyLength(); - return new Integer(ks); - */ - return null; + + int cs=ssl.getCipherSuite(); + String cipherSuite = SSLPolicyInt.getCipherSuiteName(cs); + int size = 0; + for (int i = 0; i < ciphers.length; i++) { + if (cipherSuite.indexOf(ciphers[i].phrase) >= 0) { + size = ciphers[i].keySize; + break; + } + } + Integer keySize = new Integer(size); + return keySize; } public String getSessionId() 1.3 +37 -0 jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/SSLSupport.java Index: SSLSupport.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/SSLSupport.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SSLSupport.java 13 Apr 2002 05:34:11 -0000 1.2 +++ SSLSupport.java 29 Apr 2002 00:05:32 -0000 1.3 @@ -92,6 +92,22 @@ public static final String SESSION_ID_KEY = "javax.servlet.request.ssl_session"; /** + * A mapping table to determine the number of effective bits in the key + * when using a cipher suite containing the specified cipher name. The + * underlying data came from the TLS Specification (RFC 2246), Appendix C. + */ + static final CipherData ciphers[] = { + new CipherData("_WITH_NULL_", 0), + new CipherData("_WITH_IDEA_CBC_", 128), + new CipherData("_WITH_RC2_CBC_40_", 40), + new CipherData("_WITH_RC4_40_", 40), + new CipherData("_WITH_RC4_128_", 128), + new CipherData("_WITH_DES40_CBC_", 40), + new CipherData("_WITH_DES_CBC_", 56), + new CipherData("_WITH_3DES_EDE_CBC_", 168) + }; + + /** * The cipher suite being used on this connection. */ public String getCipherSuite() throws IOException; @@ -124,4 +140,25 @@ */ public String getSessionId() throws IOException; +} +// ------------------------------------------------------------ Private Classes + + +/** + * Simple data class that represents the cipher being used, along with the + * corresponding effective key size. The specified phrase must appear in the + * name of the cipher suite to be recognized. + */ + +final class CipherData { + + String phrase = null; + + int keySize = 0; + + public CipherData(String phrase, int keySize) { + this.phrase = phrase; + this.keySize = keySize; + } + }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>