BEA Logo BEA WebLogic Server Release 5.0

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

Using WebLogic SSL

I. Introduction
Authentication
Encryption
How is SSL transported?
WebLogic Server and U.S. cryptography regulations

II. Setting up WebLogic SSL
Acquiring a certificate for your WebLogic Server
Installing certificates on a WebLogic Server

III. Using SSL in the WebLogic environment
Client connections to a WebLogic Server with SSL
Setting up two-way authentication
Setting up WebLogic to require two-way authentication
Requesting and accepting certificates from clients
Getting a certificate for a browser
Setting up a T3Client
Ping Example
HTTPS Example
Opening a secure connection to another server
Using SSL in servlets

IV. Questions and Answers about SSL

V. Change history

Other related documents
Installing WebLogic (non-Windows)
Installing WebLogic (Windows)
Using WebLogic ACLs (Access Control Lists)
The Developers Guides
WebLogic API Reference Manual
Setting WebLogic security properties
Troubleshooting Applet Security problems
Glossary
Code examples

Other online resources
SSL 3.0 Specification
Crypto Standards & Protocols
FAQ 3.0 on Cryptography

I. Introduction

With WebLogic SSL, WebLogic offers encrypted, authenticated connections via Secure Socket Layer (SSL). SSL is a standard protocol proposed by Netscape for negotiating a secure connection.

WebLogic SSL implements the SSL 3.0 specification. It does not support SSL 2.0. WebLogic SSL works with JDK 1.1.x, and the T3Client and WebLogic Server using SSL do not need to be the same JDK version.

This document provides a step-by-step guide for using SSL with WebLogic.

There are two parts to secure communications:

  • Authentication, which enables communicating parties to verify each others' identity.

  • Encryption, which makes data unintelligible to anyone without the key to decipher it.

Authentication

Authentication takes place at two levels: first, verifying that the communicating parties are who they say they are, and second, verifying that each message exchanged is from the expected sender and has not been tampered with.

SSL authentication uses a certificate, made up of a public key and some information about the owner of the corresponding private key. The certificate is signed cryptographically by a certificate authority, such as VeriSign, Baltimore CyberTrust, or Entrust. VeriSign, for example, offers four certification types that indicate to what degree the holder has been verified. (There is a full list of certificate authorities, including some lesser-known, on the SSLeay website.)

A cryptographic signature can be verified based on the public key of the certificate authority. Forging a cryptographic signature without knowing the certificate authority's private key is statistically close to impossible.

Two-way authentication requires that each party, both the server and the client, exchange certificates.

Server-to-server authentication is also supported beginning with release 3.1.3 of the WebLogic Server. A server can request a secure connection to another server and a server can be configured to require high security connections.

Encryption

SSL uses public-key cryptography to authenticate the participants in an SSL connection and to ensure a private negotiation of parameters used to encrypt data sent over the SSL connection.

Public-key cryptography is based upon public/private key pairs. A public key is used to encrypt and to verify a cryptographical signature. The corresponding private key is used to decrypt and to sign messages cryptographically. You advertise your public key to the world so that anyone can send you messages that only you can decrypt, and anyone can verify your cryptographic signature on messages you sign. You protect your private key carefully; it is never necessary to share it with anyone else and you should never send it over a network.

The protocol for establishing an SSL connection includes negotiating the most secure algorithm both client and server support. The most commonly used encryption algorithms are:

  • RSA (Rivest, Shamir, and Adelman, the names of its designers) for key exchange
  • DES (Data Encryption Standard) and its variants RC2 (a block cipher) and RC4 (a faster stream cipher) for bulk encryption
  • MD5 and SHA for message digests

A cipher suite is made up of three algorithms -- one each for key exchange, bulk encryption, and message digest. For example, the cipher suite RSA_WITH_RC4_128_MD5 uses RSA for key exchange, RC4 with a 128-bit key for bulk encryption, and MD5 for message digest.

Applications have different security requirements, which can be satisfied with various combinations of SSL features. For example, while a customer browses a retail catalog on the internet, authentication and encryption are generally not required. However, during a purchase transaction, encryption protects customers' personal data such as address and phone number, and server authentication allows the customer to trust the identification of the server on the other end of the transaction. Client authentication probably is not required -- potential customers are welcomed and the application verifies credit and payments using a process better suited to financial transactions than SSL authentication.

Client authentication is useful when you must restrict access to trusted clients only. For example, you could restrict access by accepting only clients with certificates you provide them. In this case, you are the certificate authority. This requires additional software that allows you to generate certificates. (With WebLogic software, you can generate a certificate request to submit to a certificate authority, but you cannot generate a digitally-signed certificate.)

WebLogic Server and U.S. cryptography regulations

The United States regulates the export of cryptographic software to other nations. "Strong" encryption can only be exported from the United States to qualifying customers. Because of these restrictions, the generally-available WebLogic Server has only exportable-strength encryption.

The "strength" of encryption in a software product is regulated according to the number of bits in the encryption keys. The more bits in an encryption key, the more difficult it is to break the encryption.

  • The exportable version of WebLogic Server is restricted to 512-bit certificates (for authentication and public key encryption) and 40-bit keys for bulk data encryption.

  • The domestic version of WebLogic Server supports 768-bit and 1024-bit certificates and 128-bit bulk data encryption.

Customers in the United States and in other qualifying nations can request the domestic-strength version of WebLogic Server by contacting Sales.

How is SSL transported?

The SSL protocol is customarily "tunneled" over an IP-based protocol. "Tunneling" means simply that each SSL record is encapsulated and packaged up with the proper headers to send over another protocol. SSL communications between a web or application server and its clients are encapsulated in HTTP packets for transport. You can also tunnel SSL over WebLogic's fast, multiplexed IP-based protocol, T3. The use of SSL is signified in the protocol scheme of the URL, for example:

  https://myserver.com/mypage.html
  t3s://myserver.com:7002/mypage.html

Tunneling adds overhead to any sort of communications. Using a communication protocol that must be unencrypted or authenticated will add noticeably to a client's perceived wait time.

WebLogic supports HTTPS with browsers that support SSL3. The JVM (Java Virtual Machine) doesn't currently support the HTTPS protocol adapter and consequently WebLogic depends on the implementation of SSL in the browser. Clients outside of a browser can form an SSL connection to the WebLogic Server by using WebLogic's T3S protocol, which has SSL support. Java programs running in the WebLogic Server can establish T3S connections to other WebLogic Server's or HTTPS connections to other servers that support SSL, such as webservers or secure proxy servers.

Top of section

II. Setting up WebLogic SSL

To use SSL with WebLogic, you need a private key and a digitally-signed certificate containing the matching public key. If the certificate authority who signed your certificate is not well-known, you may also need to install their certificate in your WebLogic Server. Here are the steps:

  1. Acquire a certificate for your server. You can use the Certificate servlet to generate a public key, private key, and a certificate request, which contains your public key. To obtain a certificate, you send the certificate request to a certificate authority (CA) and follow their procedures for obtaining a signed certificate.

    Important: Certificates from Microsoft Internet Information Server and Netscape Enterprise Server cannot be used with WebLogic Server, because they are stored in a proprietary format.

  2. Install the certificate you received from the CA in the per-server directory of your WebLogic Server. You can use certificates in either .der or .pem format.

  3. Set properties in the weblogic.properties file to enable SSL and specify your certificate and private key files. You can also set certificate chain properties to allow clients to authenticate the certificate authority who issued your certificate.

  4. For two-way authentication, set properties in the weblogic.properties file so that the WebLogic Server requests certificates from clients.

    You can set other properties for two-way authentication, including enabling servlets that identify and capture authentication information from the client.

  5. Begin using SSL in the WebLogic environment.

An SSL client typically keeps a list of trusted certificate authorities and alerts the user when a server presents a certificate that is not issued by a recognized authority. Extending the list of trusted certificate authorities is part of security configuration.

Newer browsers (beginning with Netscape version 2.x and Internet Explorer 4.0) can extend this list dynamically using a sequence of dialogs presented to the user when a questionable certificate is encountered. Earlier browsers have a hard-coded list of valid certificate authorities. If one of these browsers encounters a certificate from an unknown CA, it will not complete a secure connection. For these earlier browsers (Netscape 1.x, Internet Explorer 2.x and 3.x), you must request a certificate from a recognized certificate authority like VeriSign or GTE Cybertrust.

For a demonstration of using SSL with WebLogic, you can use the .der files in the weblogic/myserver directory. The ca.der file is a demonstration certificate authority's certificate. For this demonstration, WebLogic is the certificate authority. The democert.der file is a certificate signed with the public key in ca.der. The democert.key file is the private key that matches the public key in democert.der.

To install these files, copy them to your per-server directory (if it is other than /weblogic/myserver, and add these properties to your weblogic.properties file:

  weblogic.system.SSLListenPort=7001
  weblogic.security.ssl.enable=true
  weblogic.security.key.server=democert.key
  weblogic.security.certificate.server=democert.der
  weblogic.security.certificate.authority=ca.der

The demonstration certificate files help to understand how SSL certificates work, but are not sufficient for secure communications, since WebLogic is not a well-known or trusted certificate authority.

Top of section

Acquiring a certificate for your WebLogic Server

To acquire a certificate from a certificate authority, you submit your request in a particular format. The WebLogic distribution includes a server certificate request generator. This is a servlet that collects information from you and generates a private key file and a certificate request file. The servlet lets you submit the certificate request file to VeriSign or GTE CyberTrust.

Note: In the Random string field in the certificate request generator, enter a string of characters to be used by the encryption algorithm. You do not have to remember this string in the future. It is used to add an external factor to the encryption algorithm, making it more difficult for anyone to break the encryption. For this reason, you should enter a string that is not likely to be guessed. BEA strongly recommends a long string with a good mixture of uppercase and lowercase letters, digits, spaces, and punctuation characters; these long, mixed strings contribute to more secure encryption.

To run the server certificate request generator, load the Certificate servlet from your WebLogic Server into a browser, using a URL similar to this one:

  http://localhost:7001/Certificate

If the WebLogic Server is running on a different computer or listening on a different port, replace localhost or port with the correct computer name or port number.

Note: The Certificate servlet is registered in the distributed weblogic.properties file and protected with an ACL so that only the "system" user can use it. If you cannot run the servlet, check your weblogic.properties file for these properties:

weblogic.httpd.register.Certificate=utils.certificate
weblogic.allow.execute.weblogic.servlet.Certificate=system

When you load the servlet in your browser, online help is available, including instructions for obtaining a test certificate and installing the certificate on your WebLogic Server. The certificate generates three files in the WebLogic Server's startup directory.

www_mydomain_com-key.der
This is your private key file.

www_mydomain_com-request.dem
This is the encrypted certificate request file, in a binary format.

www_mydomain_com-request.pem
This is the CSR file, which you submit to the certificate authority. It contains the same data as the .dem file, but encoded in ASCII so that you can copy it into email or paste it into a web form.

If you apply to VeriSign for a permanent certificate, you are asked to select a Server Type. Choose "Apache Freeware with SSLeay" to ensure that you receive a certificate that is compatible with WebLogic Server.

If you purchase a certificate from GTE CyberTrust, follow the instructions provided for WebLogic Server.

Top of section

Installing certificates on a WebLogic Server

Once you have a certificate, you can set up your WebLogic Server for SSL as follows.
  1. Copy your private key and the certificate you received from the certificate authority into the per-server directory of your WebLogic Server.

    WebLogic Server can use certificates in either .pem or .der format. It depends upon the file extension to determine the format of the certificate file.

    A .pem format file (privacy-enhanced mail) begins with this line:

      -----BEGIN CERTIFICATE-----

    and ends with this line:

      -----END CERTIFICATE-----

    A .dem format file contains binary data. WebLogic requires that the file extension match the contents of the certificate file, so be sure to save the file you receive from your Certificate Authority with the correct file extension.

  2. Set the following properties in your weblogic.properties file:

    weblogic.system.SSLListenPort
    Set a a non-zero value to designate the port for the SSL listener

    weblogic.security.ssl.enable
    Set to "true", the default, to enable SSL. When SSL is enabled, the WebLogic Server looks for the properties that identify keys and certificates.

    weblogic.security.key.server
    Set to the name of your private key file.

    weblogic.security.certificate.server
    Set to the name of the certificate file you received from the certificate authority.

    weblogic.security.certificate.authority
    weblogic.security.certificate.authority2
    weblogic.security.certificate.authority3
    If your certificate is not issued by a well-known certificate authority, set the authority property to the name of the certificate authority's public key. You can also set the similar properties that end with authority2 and authority3 to set up a certificate chain.

    weblogic.security.clientRootCA
    If you want to use two-way authentication, set this property to the name of a certificate authority's certificate. This requires clients to present a certificate issued by that certificate authority. If you do not want to use two-way authentication, omit this property or set it to "none".

    weblogic.security.enforceClientCert
    Set this property to true to have WebLogic reject SSL connections that fail client authentication, either because the requested client certificate was not furnished, or because the client certificate was not issued by the certificate authority specified with the weblogic.security.clientRootCA configuration property.

    weblogic.security.SSLHandler.enable
    The handler that allows the WebLogic Server to make outgoing SSL connections to another server is enabled by default. For example, an EJB in WebLogic could open an HTTPS stream on another webserver and WebLogic SSL will act as the client in the SSL protocol. It is possible to disable the HTTPS handler, although this is rarely necessary. If you want to to provide your own SSL implementation for these outgoing SSL connections, you should disable the default handler in the server by setting this property to false Note that this handler has no effect on the WebLogic Server's ability to manage incoming SSL connections.

  3. Start, or restart, the WebLogic Server.

Certificate chains

The weblogic.security.certificate.authorityN properties, along with weblogic.security.certificate.server, make it possible to set up certificate chains. Certificates for the server, authority, authority2, and authority3 constitute a chain where the server certificate is digitally signed by the first certificate authority, the first certificate authority's certificate is signed by the second certificate authority, and the second certificate authority's certificate is signed by the third certificate authority.

Clients typically have an independent database of trusted certificate authorities, so you do not usually have to provide certificate authorities' certificates. Your WebLogic SSL configuration needs only a digitally-signed certificate, which contains your public key, and your matching private key.

However, if the authority who issues your certificate is not well-known, a certificate chain leading to a trusted certificate authority allows a client to authorize your certificate. If the signature on your certificate (authority) is not a trusted authority, the client checks the signature on that certificate (authority2). If authority2 is trusted, then the client can trust authority, and if authority is trusted, the client can trust you. It is up to the client to determine how far it will trace a certificate chain and still maintain trust. WebLogic allows you to chain four certificates (your own and three certificate authorities).

To set up a chain, set each property to the filename of the appropriate certificate authority's public key. All keys should be located in the WebLogic Server's per-server directory.

The demo certificate included in the distribution is for demo purposes only. If you set this property to point to the demo certificate included in the distribution an inconsistent configuration will be detected and an Exception will be thrown.

Top of section

III. Using SSL in the WebLogic environment

Making client connections to WebLogic with SSL
Setting up two-way authentication
Setting up WebLogic to require two-way authentication
Requesting and accepting certificates from clients
Getting a certificate for a browser
Setting up a T3Client
Ping Example
HTTPS Example
Opening a secure connection to another server
Using SSL in servlets

Making client connections to WebLogic with SSL

Each time a client requests an SSL connection, the WebLogic Server presents its certificate for the client to evaluate. The client decides whether to accept the certificate and proceed to form a secure connection.

If the certificate issuer is unknown, a browser may not be able to accept the certificate. If the browser accepts the certificate from an unknown certificate authority, the user will have several options as to how permanent its acceptance of certificates from this issuer should be. The user can check information about the certificate authority that issued the site certificate before accepting it.

Top of section

Two-way authentication

Two-way authentication requires clients to present a certificate to the WebLogic Server in order to establish an SSL connection. The client first authenticates the server's certificate, and then the server authenticates the client's certificate.

To enable two-way authentication, you set weblogic.security.enforceClientCert to "true" and set the weblogic.security.clientRootCA property in the weblogic.properties file to the public key of a certificate authority. With these properties set, WebLogic asks each client to present a certificate and denies the connection if the certificate was not issued by the specified CA. Currently, WebLogic supports only a single client root certificate authority.

If you issue your own certificates, you can use two-way authentication to allow access only to clients with certificates you issue. Just set the weblogic.security.clientRootCA property to the name of your own certificate file. Note that to issue your own certificates, you will need additional software. WebLogic software allows you to generate a request for a certificate, which can be fulfilled by a certificate authority, but you cannot generate an actual certificate.

Setting up WebLogic to require SSL connections

To restrict WebLogic to only SSL connections, you set the two-way authentication properties described above and you must protect your non-SSL listen port with a firewall that allows access only to the SSL listen port. For example, configure the firewall to allow access only to port 443 and configure the WebLogic Server to listen for SSL connections on that port:

  weblogic.system.SSLListenPort=443

Configure the certificate authority for SSL clients by setting the weblogic.security.clientRootCA property to the filename of the certificate from the certificate authority and enable two-way authentication by setting weblogic.security.enforceClientCert to "true."

Requesting and accepting certificates from clients

To authenticate clients in a servlet (or any other server-side Java program), you can check whether the client presented a certificate, and if that certificate was authorized by a trusted issuer. The servlet author is responsible for asking if there is a valid certificate. See the section Using SSL in servlets for more about SSL and the servlet API.

Two-way authentication from an applet is more difficult because applets cannot access the certificate of the browser in which they run. One solution is to allow applets indirect access to the browser's certificate via the WebLogic Server. The servlet can capture the browser's certificate and reveal it only when a specific 64-bit token is presented. It can then create an HTML page with an applet tag that passes the token as a parameter.

The ClientAuthenticationServlet addresses the problem of how applets can establish secure communications that use the same certificates for authorization as the browser that loaded the applet. If your browser client connects to the WebLogic Server with the URL path authenticated/some_directory, the browser's certificate will be captured and stored in a safe place under a randomly generated 64-bit token. The servlet then creates an HTML page -- with the stored token -- for loading the applet. The token can be redeemed once (and only once) and is as good as the certificate itself. In general, presenting the right token authenticates applets just as presenting the certificate authenticated the browser running the applet.

To safeguard the WebLogic Server from having to store tokens indefinitely that are never claimed and used, you can limit the number of certificates that are tokenized and stored by setting the following property:

  weblogic.security.certificateCacheSize=number of certificates

The default setting for this property is 3:

  // Registration for authentication servlet
  weblogic.httpd.register.authenticated=\
    weblogic.t3.srvr.ClientAuthenticationServlet

  // Registration for servlet that identifies certificate roots
  // of certificates that should be accepted
  weblogic.httpd.register.T3AdminCaptureRootCA=\
    admin.T3AdminCaptureRootCA
  weblogic.security.certificateCacheSize=3

If you are using access control lists, you can write or adapt a realm that handles certificate-based authentication.

Getting a certificate for a browser

Low-security browser certificates are easy to acquire and can be done from within the browser, usually by selecting the Security menu item in Options or Preferences. Go to the Personal Certificates item and ask to obtain a new certificate. You will be asked for some information about yourself.

The certificate you receive contains public information, including your name and public key, and additional information you would like authenticated by a third party, such as your email address. Later you will present the certificate when authentication is requested.

As part of the process of acquiring a certificate, the browser generates a public-private key pair. Your private key should remain secret. It is stored on your local file system and should never leave the browser's machine, to ensure that the process of acquiring a certificate is itself safe. With some browsers, the private key can be encrypted using a password, which is not stored. When you encrypt your private key, you will be asked by the browser for your password at least once per session.

As part of SSL negotiation, after your certificate has been submitted to a server, your browser will send a CertificateVerify message, consisting of a digest of the messages sent thus far, signed with your private key. The digest can be computed on the server and the signature verified using your public key, which is part of your public certificate.

You should note that certificates are not universally useful for multiple browsers, or even for different versions of the same browser.

Top of section

Setting up a T3Client

When a T3Client requests a secure connection, the WebLogic Server first sends a public key to the T3Client that will be used for future encrypted transactions.

Your request for a secure transaction is in the WebLogic Server URL you use when you construct a T3Client. You use the URL scheme "t3s" in the URL, as in this example:

  T3Client t3s = new T3Client("t3s://WebLogicURL:port");

where the WebLogicURL is set to your server and port is set to the port that is listening for SSL connections (weblogic.system.SSLListenPort). There is more info on connecting to WebLogic over various protocols in the Developers Guide, Writing a T3Client. Once secured, a connection to WebLogic is secure for all transactions.

Using SSL slows network transfer rates. Although not as fast an unencrypted data transfer, in many interactions, encrypted data transfer is not the bottleneck. Data transfer is only one part of a client-to-server interaction.

Ping Example

You can ping the WebLogic Server to test secure communications, with the command:
  $ java weblogic.T3Admin t3s://WebLogicURL:Port PING
where the WebLogicURL is set to your server and Port is set to the port that is listening for SSL connections (weblogic.system.SSLListenPort).

The ping first agrees on a cipher suite to use. For example, cipher suite 3 is SSL_RSA_EXPORT_WITH_RC4_40_MD5, which means that the connection uses SSL with RSA exportable grade authenticated key exchange, 40-bit bulk data encryption using the RC4 stream cipher algorithm, and the MD5 algorithm for digesting. To see which cipher suite is selected and all the gory encryption details, run the command with -Dssl.debug, as in:

  $ java -Dssl.debug weblogic.T3Admin t3s://WebLogicURL:Port PING

HTTPS Example

To enable SSL on WebLogic, you set the property weblogic.security.SSLListenPort to non-zero and start the WebLogic Server. Then you use that port number in your client's URLs. Make sure that you have set the property before continuing.

Note that HTTPS is not available for use in a browser application unless the browser supports SSL3 as it is in most browsers. If you have problems running a browser based application, verify that the browser you are using is new enough to include SSL3. Both Microsoft Internet Explorer and Netscape versions after 4.0 include support for SSL.

Point a local browser at the URL https://localhost:7002/T3AdminMain, where the URL matches your WebLogic Server and SSL listenport. The browser and the WebLogic Server will then negotiate a cipher suite. If there is no satisfactory resolution, you can edit the security preferences in the browser to enable "RC4 encryption with a 40-bit key and a MD5 MAC."

When the connection is established, the T3Admin servlet executes exactly as if it had been requested with an HTTP URL. However, all network traffic between the client and server is encrypted.

Top of section

Using SSL in servlets

When writing servlets with the servlet API, you have access to certain information about the SSL connection through the HttpServletRequest object's getAttribute() method.

In order to print SSL information, this method could be added to the SnoopServlet, which is provided in the WebLogic Server examples. As written, the SnoopServlet echos back the request line and headers that were sent by the client, plus any HTTPS information which is accessible.

The following attributes are supported in WebLogic Security:

  • javax.net.ssl.cipher_suite returns the cipher suite in use as a String.

  • javax.net.ssl.session, which returns an SSL Session object, contains all of the above data, plus creation and last-used dates.

  • javax.net.ssl.rootCA, which returns the certificate from the configured weblogic.security.clientRootCA as a String.

  • javax.net.ssl.rootCADigest, which returns the certificate digest from the configured weblogic.security.clientRootCA as a String.

  • Obtain information about the client's certificate chains with the attribute javax.net.ssl.peer_certificates, which returns an array of X509 certificate chains as Objects. You can cast the Object array to weblogic.security.X509[].

  • Given an array of X509 certificate chains, you have access to a set of user information, such as the user name. You can see the available information associated with each certificate chain by calling toString() on it.

  • You can create a weblogic.security.JDK111Certificate object by passing an X509 certificate to its constructor. The weblogic.security.JDK111Certificate class implements the java.security.Certificate interface. Here is an example that converts the first X509 certificate in an array of weblogic.security.X509:
     weblogic.security.JDK11Certificate jdk11cert =
          new weblogic.security.JDK11Certificate(X509certs[0]);
          print(out, "jdk11cert.getPrincipal().getName() - ", 
                     jdk11cert.getPrincipal().getName() );
          print(out, "jdk11cert.getGuarantor().getName() - ", 
                     jdk11cert.getGuarantor().getName() );

    The weblogic.security.JDK111Certificate class has additional member functions that are not accessible through the Certificate interface:

    • getIssuerCertificate() returns the issuer's certificate as a java.security.Certificate object.

    • getFingerprint() returns the certificate's fingerprint. This is the MD5 of the DER encoded X.509 certificate. Is presumed difficult to construct a different certificate with the identical fingerprint.

    • getSubjectOrgUnit() returns a String containing the Organizational Unit of the subjectDN (distinguished name) from the Certificate.

Opening a secure connection to another server

You can connect to a second server using two-way authentication with your server's certificate. The example below establishes a secure connection to a WebLogic Server called "server2.weblogic.com" from a servlet running in another server:

  Environment e = new Environment();
  e.setProviderUrl("t3s://server2.weblogic.com:443");
  e.setSSLClientCertificateFromServer();
  e.setSSLServerName("server2.weblogic.com");
  e.setSSLRootCAFingerprints("ac45e2d1ce492252acc27ee5c345ef26");

  T3Client t3c = e.createProviderClient();
  t3c.connect();

  e.setInitialContextFactory("weblogic.jndi.WLInitialContextFactory");
  Context ctx = new InitialContext(e.getProperties()) 

The Environment class creates a Hashtable to store parameters to pass to the JNDI InitialContext factory. The provider client URL specifies the t3s protocol, which is the WebLogic specific protocol, t3, over SSL. The next line enables the server's own certificate to be used for SSL client authentication. An alternative method setSSLClientCertificate(), could be used here instead to set a certificate chain to use for the connection. The chain is an array that contains a private key, the matching signed public key, and a chain of CA certificates, each the issuer of the previous certificate.

The next two lines protect against a man-in-the-middle attack. They specify that the server certificate must be for a specific server, in this example, "server2.weblogic.com," and the certificate must be issued by a certificate authority with a specific fingerprint. The createProviderClient() method creates the secure connection using the parameters stored in the Environment object.

See Using WebLogic JNDI for more on using JNDI to access services in a WebLogic Server.

For more information on servlets, see the Developers Guide Using WebLogic HTTP Servlets.

Top of section

IV. Questions and Answers about SSL

Because there are many issues related to using SSL that aren't specific to WebLogic, we have provided an additional set of questions and answers to help you with your implementation.

Q If I am accepting certificates from a third party signer, such as VeriSign, how do I limit access to users who have registered with me? Should I capture the fingerprint of their certificate when they register at the site and then validate it every time they they attach in the future?

A Unfortunately, it is not quite so simple. The certificate really identifies a specific browser, not an individual. Until browsers integrate with smart cards for their certificates, an individual will have as many separate certificates as browsers. You might consider capturing the certificate holder's name rather than the certificate's fingerprint, since -- in theory -- the CA guarantees that the name is significant. Unfortunately, the free VeriSign certificate guarantees only the email address. Another option is to act as your own certificate authority on registration.

Q&A about SSL

Q I wish to restrict access only to certificates issued by my company for two-way authentication between clients and the WebLogic Server. How do I do this?

A For two-way authentication, enable browser SSL client authentication and check the root certificate authority in the body of a servlet.

Configure WebLogic for client authentication with the properties:

weblogic.security.clientRootCA=client-ca-cert.der
weblogic.security.enforceClientCert=true
where client-ca-cert.der is a certificate file in .der format.

The certificate from the configured weblogic.security.clientRootCA and its digest are accessible through the servlet request attributes javax.net.ssl.rootCA, and javax.net.ssl.rootCADigest.

Q&A about SSL

Q How can I find a certificate's fingerprint?

A A certificate's fingerprint is not part of the certificate, but it can be computed from it. Browsers tend to display it as if it were part of the certificate. A fingerprint is the MD5 digest of the der-encoded CertificateInfo, which is an ASN.1 type specified as part of the X.509 specification.

The weblogic.security.JDK111Certificate.getFingerprint() method calculates the fingerprint of a certificate, returning a byte array. Here is some code to demonstrate how to get the fingerprint of a certificate and print it out in hexadecimal:

import java.io.*; 
import weblogic.security.X509;
import weblogic.security.JDK11Certificate; 

public class fingerprint {

  private static char hexdigits[] = { 
    '0','1','2','3','4','5','6','7',
    '8','9','A','B','C','D','E','F'};

  public static void main(String[] argv)
       throws Exception 
  { 
    InputStream is = null;
    JDK11Certificate cert = null;
    byte fp[];

    try {
      is = new FileInputStream(argv[0]);
    }
    catch (FileNotFoundException e)  {
      System.out.println("Can't find file " + argv[0]);
      e.printStackTrace();
    }

    try {
      cert = new JDK11Certificate(new X509(is));
    }
    catch (Exception e) {
      e.printStackTrace();
    }

    fp = cert.getFingerprint();
    System.out.print("Fingerprint:");
    for (int i = 0; i < fp.length; i++) {
      System.out.print(" "
                       + hexdigits[(fp[i] & 0xff) >> 4]
                       + hexdigits[(fp[i] & 0xf)]);
    }
    System.out.println("");
  }
}

Q&A about SSL

Q I am currently working on an applet that requires two-way authentication in lieu of the user/password model. How does the token/certificate exchange happen?

How do you implement two-way authentication in an applet?

A Client authentication is transparent to the applet. It happens between the browser and the server. The servlet has access to the browser's certificate chain through the request attribute javax.net.ssl.peer_certificates.

An example of this is the "SnoopServlet" in package examples.servlets, which uses javax.net.ssl.peer_certificates to access, display, and print the certificate.

The applet, however, cannot directly access the browser's certificate. If it needs information from the certificate, it needs to get it from the server.

A special servlet can store the browser's certificate and exchange it for a token, which is passed to the applet as a parameter.

If you want to use certificates in place of password authentication, follow these steps to set up WebLogic. (This only applies to WebLogic version 3 and higher):

  1. Turn authentication of the browser certificates off at the WebLogic level by giving the specific servlet X the property everyone:
    
      weblogic.allow.execute.weblogic.servlet.X=everyone

  2. Enable client authentication by specifying a certificate for the client root certificate authority with a property such as:
    
      weblogic.security.clientRootCA=client-ca-cert.der
    
    where client-ca-cert.der is the root certificate for authentication of the clients.

    If you do not have the root certificate for the client certificates that you want to authenticate, you can use the servlet admin.T3AdminCaptureRootCA to capture the root certificate and save it to a .der file.

  3. Within the servlet, access this certificate chain through the servlet request attribute javax.net.ssl.rootCA.

Q&A about SSL

Q Is there a simple way to restrict access only to clients that have certificates issued by a particular certificate authority?

A You can snoop the certificate authorities of the client with the T3AdminCaptureRootCA servlet, which is registered in the weblogic.properties file. T3AdminCaptureRootCA gets a certificate chain from the browser client and writes the certificate authority's key out to a standard file that you can set as the value for the weblogic.security.clientRootCA. Also set weblogic.security.enforceClientCert to "true." Then, once you have restarted the WebLogic Server, the browser client can return and ask for authorization, and the test for RootIsValid will return true.

Top of page

Q What about the SSL-related security bulletin #7 from RSA?

A On June 16, 1998, RSA released a security bulletin (#7) which notified its licensees about a vulnerability in the PKCS1 standard. This standard is used in SSL as part of the initial key exchange. It advised its licensees on measures to take to ensure security on systems that use RSA.

The vulnerability is purely theoretical. It consists of distinguishing between two kinds of error responses. To exploit it, an attacker would have to carefully generate and analyze on the order of one million error responses from an SSL server.

WebLogic uses RSA in its SSL implementation. Based on the suggested fix from RSA, WebLogic changed how encoding failures are handled so that error messages are completely uniform. The changes are included in WebLogic release 3.1 and later.

Top of page

V. Change history

Release 4.0.2

Enabled the weblogic.login.readTimeoutMillisSSL property, which had been inadvertently disabled in release 4.0.1. This property is described in the Administrators Guide Setting WebLogic properties.

We have added the feature that if a WebLogic Server has both domestic and exportable certificates, it will attempt a connection based on the browsers' best available certificate.

Release 4.0.1

Improved support for domestic-strength encryption, which allows the use of 512-, 768-, and 1024-bit keys. (In accordance with United States law, the standard exportable-strength WebLogic distribution supports only 512-bit keys. Contact your sales representative if you want to obtain the domestic-strength distribution.) In the domestic version, the Certificate Request servlet allows you to select the strength (key length) of your certificate.

Also added support for the domestic-strength encryption to the Certificate Request servlet.

Release 4.0.0

Fixed a problem where HTTPS connections from a WebLogic Server to another SSL server sometimes failed with an IOException. The fix accounts for a variation in the method of computing message digests and the handling of end-of-file condition when reading HTTP streams.

Release 3.1.8

Modified the Certificate request generator so that you can specify the key length. This new feature only appears in the domestic-strength version of the WebLogic distribution. You can select 512-, 768-, or 1024-bit encryption keys. The exportable-strength version always uses 512-bit keys.

Improved error handling when the WebLogic Server is tunneling through an SSL proxy server and the proxy server drops the connection. Rather than throwing a null pointer exception, this condition is caught and a message is recorded in the log.

Release 3.1.6

Added a new property, weblogic.security.SSLHandler.enable, which defaults to true. When true, the WebLogic Server initializes the handler for outgoing (server-to-server) HTTPS connections.

Before this change, the handler was not initialized by default; to make a server-to-server HTTPS connection, you either had to call weblogic.common.SSLInitializer() to initialize the HTTPS handler or create your own HTTPS handler.

After this change, you do not need to do anything unless you want to provide your own handler for outgoing HTTPS connections. For information on providing your own HTTPS handler, see the documentation for java.net.URLStreamHandler in the JDK documentation.

Release 3.1.3

Added a new weblogic.login.readTimeoutMilliSSL property to control the timeout on newly opened sockets with SSL connections. In earlier releases, the WebLogic Server used a multiple of the weblogic.login.readTimeoutMilli property value to time out SSL connections. The new property allows you to set a timeout for SSL sockets independently. The default is 15000 (15 seconds). To disable the timeout, set the property to 0. The maximum value is 100000 (100 seconds).

Added a new weblogic.security.enforceClientCert property to make it possible to require authentication. See Setting up WebLogic to require two-way authentication for instructions for using this property.

Added a new class, weblogic.security.JDK111Certificate, which implements the java.security.Certificate interface. WebLogic makes the chain of client certificates from SSL authentication available to servlets through the javax.net.ssl.peer_certificates servlet request attribute. The weblogic.security.JDK111Certificate class has two additional member functions that are not accessible through the Certificate interface:

  • getIssuerCertificate(), which returns the issuer's certificate as a java.security.Certificate.
  • getFingerprint(), which returns the certificate's fingerprint. This is the MD5 of the DER encoded X.509 certificate. Is presumed difficult to construct a different certificate with the identical fingerprint.

See Using SSL in servlets for more information.

Release 3.1.2

Added the Certificate Request Generator servlet. The servlet is registered in the weblogic.properties file with this property:
  weblogic.httpd.register.Certificate=utils.certificate

Release 3.1

Added a new property to enable and disable SSL: weblogic.security.ssl.enable=boolean. The default for this property is false. To enable SSL, you must set this property to true. Note that setting the port number to "7002" is no longer sufficient to enable SSL, and setting the port number to "0" is no longer sufficient to disable SSL.

Added support for certificate chains, with new properties weblogic.security.certificate.authority2 and weblogic.security.certificate.authority3. For more information, see certificate chains in this document.

Release 3.0.1 -- 2/17/98

Reorganized sections, checked and corrected links

Added additional Q&A sections

Release 3.0 -- 1/29/98

No changes.

Release 2.5 -- 8/23/97

General changes

Improved error reporting for SSL configuration problems, with more explicit Exceptions that now say which property and property value resulted in an absent or invalid file.

Property changes

weblogic.security.certificateCacheSize
Added. For SSL, limits the number of outstanding tokens cached for exchange for use with applets. For more information, see information about tokens in this document.

weblogic.security.certificate.authority
Made the certificate authority (CA) certificate optional. This corresponds to the property weblogic.security.certificate.authority in the weblogic.properties file, which you may comment out if you do not wish to set it. This is possible because browsers store the whole certificate of the CAs that it trusts. The issuer's name is part of the server certificate, but the public key of the issuer is not. It is still necessary to configure WebLogic with a CA certificate file when the CA is not widely recognized.

Added a "certificate issuer" certificate for VeriSign (SecureServerCA.der).

Added support for Privacy Enhanced Mail (PEM) format. The name of the file must end with .pem.

 

Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
Last updated 9/27/1999